Monday, February 20, 2012

Passing system variables to stored procedure

How do I pass system variables to a stored procedure? Is it possible to have an OLE DB transformation with the following sql command: exec InsertIntoLog @.MachineName, @.TaskName...? Do I have to use a Derived Transformation first to 'convert' variables into columns and then use exec InsertIntoLog ?, ? ...

Thanks for the help.

In the execute sql task refer to parameters with question marks. Then on the parameter mapping page of the execute sql task you can map the question marks to variables.

|||

Thanx...I need the same for the OLE DB transformation

|||

Do you mean OLE DB source? It's pretty much the same as the execute sql task.

Put question mark's where you want the variable then click the 'parameters' button and choose the variable that you want to use for it.

If your source provider (DB2) doesn't allow you to pass parameters you'll have to create a variable that builds the sql statement referencing another variable. Then change the 'data access mode' in the ole db source to 'sql command from variable'.

Good luck.

|||

I mean OLE DB Command Transformation...

|||

I think the answer to your original question you want is yes, use the Derived Column to make a variable into a column so that you can use it, and question marks are the placeholders.

|||

Audit transformation can also be used (I need to populate log table).

No comments:

Post a Comment