2011-11-09 123 views
2

我有我的执行SQL任务以下INSERT语句在SSIS:SSIS执行SQL任务的SQL命令问题

INSERT INTO dbo.SSISLogTest 
    (NodeID, BusinessDate, StartDate, StopDate, StepName, RecordCount, Message, Status, UserID) 
VALUES  (?,?,?,?,?,?,?,?,?) 

当我运行它的任务中提供的参数在执行罚款,并在表中插入一条记录。

当运行该程序包,此步骤失败,错误如下:

"[Execute SQL Task] Error: Executing the query "INSERT INTO dbo.SSISLogTest ..." failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. "

+1

我说你有没有在SSIS参数设置的正确。你能详细说明你是如何做到的吗?将参数通过变量传递到包中很麻烦,如果不以特定的方式完成,可能会出错。 – mwan

回答

9

不同的连接提供者要求不同的语法 - 以下所有的必须正确设置:

  • 连接类型(即OLE DB,ADO ...)您的选择,但旨在在整个应用程序中使用相同的选项。
  • “参数映射”对话框中参数的数量和详细信息(变量名称,方向,数据类型,参数名称,参数大小)。
  • 在SQL查询中的参数语法(即您的问号。)

请参见下面的屏幕截图的OLEDB例子,参考Working with Parameters and Return Codes in the Execute SQL Task了解详情。

enter image description here

Execute SQL Task - General

enter image description here

+0

我发现这个问题是由于我实际上已经命名,而不是提供序号。感谢截图:-) – user1036833

+4

“[SQL]标准的好处在于有很多选择”:-) –