Link to home
Start Free TrialLog in
Avatar of EddieIT
EddieIT

asked on

SSIS package, ForEach Loop Container Variable pass to SQL stored procedure

Hello Experts, I have created a For Each Loop Container in SQL2012 which reads and imports flat files Into SQL table. After the import is done, I need to update the SQL records with the file name used to create the records. In SQL2008R2, I do this with no issues using the SQL task, however in SQL2012, I'm not able to pass the variable of the file name successfully. Please let me know if you have any available examples.
Avatar of Easwaran Paramasivam
Easwaran Paramasivam
Flag of India image

You can pass parameter using ParameterMapping. Please do refer below links:
http://technet.microsoft.com/en-us/library/ms140355.aspx
http://www.sqlsafety.com/?p=276
Try using an expression to build your update statement in the Execute SQL task.  This is sometimes easier and more reliable than using parameterized queries.
Avatar of EddieIT
EddieIT

ASKER

Can you please provide and example of an expression to use for SQL statements?
Something like this:

"update dbo.mytable set myfield = getdate() where FileName = '" + (DT_WSTR, 20)@[User::FileName] +"'"
Avatar of EddieIT

ASKER

Can u send a screenshot of a configured expression?
ASKER CERTIFIED SOLUTION
Avatar of Randy Knight, MCM
Randy Knight, MCM
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial