all groups > sql server dts > july 2006 >
You're in the

sql server dts

group:

Parameters to Insert SQL


Parameters to Insert SQL Maria
7/31/2006 10:57:01 AM
sql server dts: I am passing multiple variables from Dataflow into a SQL Task in Control
Flow. In SQLTask I have an insert statment, joining multiple tables and also
using variables.

For example

Insert into Table1
(Col1,Col2,Col3,Col4)
SELECT
?,
?,
empID,
getdate()
from blah1
where blah1.col3=99

Col1,Col2 are the parameters coming from the DataFlow.

If I do not use the another table(blah1) then parameters are recognized and
inserted properly but whenever I have another table in the insert statement,
then it is not working. And the error is like this

[Execute SQL Task] Error: Executing the query "Insert into Table1
(Col1,Col2,Col3,Col4)
SELECT
?,
?,
empID,
getdate()
from blah1
where blah1.col3=99
" failed with the following error: "Syntax error, permission violation, or
other nonspecific error". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly, or
connection not established correctly.


Thanks for any help

Re: Parameters to Insert SQL Allan Mitchell
8/1/2006 1:39:46 PM
It could just be that the statement is too complicated for the driver to
recognise. i would try using a property expression instead to uild the
statement.

For all things to do with the ExecuteSQL task have a look here.

The ExecuteSQL Task
(http://www.sqlis.com/default.aspx?58)

--


Allan Mitchell
Konesans Ltd
T +44 7966 476 572
F +44 2071 008 479
http://www.konesans.com



[quoted text, click to view]

Re: Parameters to Insert SQL Maria
8/2/2006 9:14:03 AM
Thanks for the hint. It made me to think about a stored procedure and it
WORKed very well with the Procedure.

Thanks,


[quoted text, click to view]
AddThis Social Bookmark Button