create a SSIS package which will call the stored procedure and dump the output of the procedure into table

  • I want to create a SSIS package which will call the stored procedure and dump the output of the procedure into table.

    This stored procedure accept an input parameter e.g. Date which i can retrieve from another table like select max(Date) from userid and pass to procedure.

    SSIS packae will return the output and i need this resultset ouput to dump into another table.

    But before inserting i want to delete the rows from that tables if any rows exist for that date and then finally insert the resultset.

  • Karan_W (1/19/2011)


    I want to create a SSIS package which will call the stored procedure and dump the output of the procedure into table.

    This stored procedure accept an input parameter e.g. Date which i can retrieve from another table like select max(Date) from userid and pass to procedure.

    SSIS packae will return the output and i need this resultset ouput to dump into another table.

    But before inserting i want to delete the rows from that tables if any rows exist for that date and then finally insert the resultset.

    ..and your question is?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • OK, maybe that was a bit harsh on an SSIS newbie.

    After looking at this, I must admit that I found myself thinking that it would be easier to get the stored procedure to do everything, rather than faffing around with the various SSIS tasks that you would need.

    Everything you have asked for (barring the initial parameterised call to the sp) can easily be accommodated in T-SQL - so why have you decided on using SSIS?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Hi ,

    Thanks for reply. Yes it can be done by SP also but requirement is to get it done by SSIS only so any help would be really appreciable.

  • Hi Karan,

    Use the execute SQL task to run your stored procedures in the sequence required.

    Regards,

    Barkha.

  • I am still not able to make any progress.

    The steps i am doing:

    1st step:Execute Sql task--To get the max(date) mdate from table and assign the madate to user defined variable in resultset otopn of task.

    2nd Step: Another Execute Sql task to delete the data from table based on passed parameter

    3rd Step:Drag n drop a data flow task--it contains one oledb source

    and one oledb destination.

    Inside oledb source, i have defined oledb connection manager.

    Data access mode is sql command and passing SP name e.g.

    exec sp_name @UserDate = ?

    @UserDate is actual input parameter passed to SP.

    After this i am maaping parameter with User variable.

    Once i click on preview i get the error messgae..no value given for one or more required parameter.

    If i change the sql command like exec sp_name ? then also same error.

    Can anyone help me to resolve this?

  • Try something like below...

    SET NOCOUNT ON

    exec sp_name @UserDate = ?

    and pass parameter in Parameters Tab (@UserDate = <Variable Name>)

  • Pretty cryptic response....

    I tried it in my call to a stored proc from a Foreach loop and the "No value given for one or more required parameters." is still issued.

    /john

  • Hi Karan.

    Your issue sounds similar to mine - if I understand your's correctly?

    My scope: Pass SSIS package data to stored procedure parameters. In my case it is email information (EG, To, From, etc).

    I'm developing in VS 2008, utilizing Execute SQL Task.

    In the SqlStatementSource text box (see Properties pane for task) I entered ...

    EXEC usp.your_stored_procedure

    In the SqlStatementSourceType drop down box (see Properties pane for task) I selected ...

    DirectInput

    Read your stored procedure for the parameters it is expecting. In my case some parameters were @To_Address, @From_Address, @Subject_Line, @status.

    In the SqlStatementSource I added/appended the following ...

    EXEC usp.your_stored_procedure @To_Address='to@address.com', @From_Address='from@address.com' , @Subject_Line='Test Subject Line', @status=1

    Note:

    Values passed to parameter must be in synch with defined sp parms. IE, characters in quotes, numeric not.

    Each additional parameter must be delimited with a comma.

    The email addresses, stored procedure and parameters are made up for this example.

    This solution can be tedious (good ol' fashion hard coding) and not future-support-friendly. :w00t:

    My next hurdle is to utilize SSIS user variables. I've created the variables but not certain the syntax.

    It's test, test, test time. I've read of others having similar errors but have yet to find solution. More opportunity to learn! 🙂

    Hope this helps.

    Steve

Viewing 9 posts - 1 through 8 (of 8 total)

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