2013-10-11 26 views
1

我在OLEDB命令轉換中使用下面的SQL語句。SSIS OleDBCommand轉換 - 支持的語法

語法1:

INSERT INTO dbo.Table1 (col1,col2) 
SELECT ?, 22 FROM dbo.Table1 

但是,它失敗的錯誤:

syntax error , permission violation or other nonspecific error.

然而,這句法工作正常。

語法2:

INSERT INTO dbo.Table1 (col1,col2) 
values (?,?) 

是語法1不支持SSIS?

回答

1
There's a hack to make it work & Martina White (http://dataqueen.unlimitedviz.com/) helped me out with it. 

Below is her transcript: 
I can duplicate your issue. There is a funky issue with OLE DB Command. When I write the query with the Values statement commented out, the Syntax 1 query as you have written it does work. When I remove the commented out statement it does not work. It seems to want the word Values() in there, regardless of whether it is commented out. 

Try this and see if you get the same behaviour. If so, this should work successfully for you. 

INSERT INTO dbo.Table1 (col1,col2) 
--Values() 
SELECT ?, 22 FROM dbo.Table1 
+0

這絕對是荒謬的。但工作。 – Valuk

0

不,它不是;實際上,它不受我所知道的任何數據庫的支持。您不能參數化SELECT語句的列。