2011-11-09 104 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]標準的好處在於有很多選擇」:-) –