문제

I'm using the below SQL statement in a OLEDB command transformation.

Syntax 1:

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

But, it fails with an error:

syntax error , permission violation or other nonspecific error.

However, this syntax works fine.

Syntax 2:

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

Is Syntax 1 not supported by SSIS?

도움이 되었습니까?

해결책

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

다른 팁

No, it is not; in fact, it's not supported by any database that I'm aware of. You cannot parameterize the columns of a SELECT statement.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top