Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 执行表类型参数时出错_Sql Server_Biztalk_Biztalk 2013 - Fatal编程技术网

Sql server 执行表类型参数时出错

Sql server 执行表类型参数时出错,sql-server,biztalk,biztalk-2013,Sql Server,Biztalk,Biztalk 2013,我正在尝试使用BizTalk将数据插入表中,代码如下。但我面临错误,因为过程或函数Emp_Details指定了太多参数 有人能帮我解决同样的问题吗 ALTER PROCEDURE [dbo].[Emp_Details] (@InsertDetails InsertDetailsType readonly) AS Begin Truncate table [dbo].[Emp_Details] INSERT INT

我正在尝试使用BizTalk将数据插入表中,代码如下。但我面临错误,因为过程或函数Emp_Details指定了太多参数

有人能帮我解决同样的问题吗

ALTER PROCEDURE [dbo].[Emp_Details]

                (@InsertDetails InsertDetailsType readonly)
    AS
    Begin 

    Truncate table [dbo].[Emp_Details]

          INSERT INTO [dbo].[Emp_Details]
               (
                [NAME],
                [DESCRIPTION],
                [EMPID]

            )
        select 

                [NAME],
                [DESCRIPTION],
                [EMPID]
    from @InsertDetails;


    Begin
    if exists(select 1 from [dbo].[Emp_Details]where NAME='Raul')

    Delete from [Emp_Details]where NAME='Raul'

    End 

    end

重新发布以前用作参考的相同示例代码

USE <Database>
GO

/* This is a template table */
CREATE TYPE Emp_Details AS TABLE   
( [Name]        VARCHAR(100)  
, [Description] VARCHAR(100) 
, [Address]     VARCHAR(100));  
GO

/* The following is your Table Emp_Details which you must be having already*/
CREATE TABLE Emp_Details
( [Name]        VARCHAR(100)  
, [Description] VARCHAR(100) 
, [Address]     VARCHAR(100));  
GO 

/* Consider this as your Input Data i.e CSV file or Excel (Note: I have created a table for sample)*/
CREATE TABLE Emp_Details1
( [Name]        VARCHAR(100)  
, [Description] VARCHAR(100) 
, [Address]     VARCHAR(100));  
GO 


INSERT INTO Emp_Details1 VALUES ('John','Test','123')
INSERT INTO Emp_Details1 VALUES ('John1','Test1','1234')
INSERT INTO Emp_Details1 VALUES ('John2','Test2','1235')
GO

SELECT * FROM Emp_Details

/* Declare a variable that references the type. So when you reference a `TYPE` it takes the table template which we created previously*/  
DECLARE @Emp AS Emp_Details;  

/* Add data to the table variable. In your case push the data that you get into the @Emp */  
INSERT INTO @Emp ([Name], [Description], [Address])  
    SELECT [Name], [Description], [Address]
    FROM Emp_Details1;  

/* Pass the table variable data to a stored procedure. */  
EXEC [dbo].[Insert_Deatils]  @Emp;  
GO 

SELECT * FROM Emp_Details

在这里声明该表类型@InsertAircraftEdited..现在检查截断Emp_Details表的第一条语句中的代码,然后检查为什么选择if exists条件这是因为。。。插入文件时,文件可能包含表中不需要的行。。。所以所有的行都被插入。。。它将被删除您可以发布用于调用存储过程的BizTalk架构吗?我怀疑您无法让BizTalk使用自定义数据库类型,您必须将@NAME、@DESCRIPTION和@EMPID作为单独的参数传递。事实上,这可能就是它所做的,因此你会得到错误。我不明白this@Raul在代码中添加了一些注释,如果您仍然无法理解,请解释代码的哪一部分。