SSIS - Exec SP in Data flow

  • I have a SP that does bunch of stuff. It ends with a select statement from a temp table. How do I invoke that SP and send the output to a Destination in Data Flow?

  • 1. Use the OLEDB source component. In the source editor, choose the 'Data Access Mode' as SQL Command.

    2. In SQL Command Text, provide the procedure to be executed. Eg : Exec USP_MyCalc ?, ?

    3. Use the parameters button in order to pass the relevant values from SSIS variables. Map them to the name of the params in procedures. (@param1 = @User:choice1)

    4. You might not be able to view the columns( in the source editor) because the stored procedures do not provide the metadata.

    5. Now you can map the output data of the source to a transformation component or a destination as you desire.

    Regards,

    Suresh

  • I am not passing anything to the SP. I need it to return the values from the select statement inside the SP.

  • ugh3012 (8/5/2013)


    I have a SP that does bunch of stuff. It ends with a select statement from a temp table. How do I invoke that SP and send the output to a Destination in Data Flow?

    If I understand your question, you're looking to take the results from the select at the end of the stored procedure and use it as the source in a data flow. To do this, set up the OLEDB data source using the proper connection manager. In the source editor, data access mode, select SQL command. For the SQL command text, invoke your stored procedure. When you check the columns in the editor, you should see the columns from the select at the end of your stored procedure.

    [Edit, follow-up] I apologize--I missed that the table at the end of the procedure was a temp table. The process I described works for a permanent table. I've not worked with a temp table as a source but the following references may be helpful:

    1. MSDN Discussion

    2. MSSQLTips Problem/Solution[/url]

    Neither address the exact scenario you describe but may point you in a helpful direction.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply