Executing stored proc stored in variable

  • Is it possible to use an Execute SQL Task to execute a stored proc, when the proc name is stored in a variable?

    I have a situation in which I need to pull a list of email recipients from the database, but the sproc to retrieve that list will vary depending on other factors.  My first thought was to store that proc name in a variable earlier in the project.  I've tried to use SQLStatements such as "exec ?" and referencing the variable through the parameter mapping, but that throws an error.  I've also tried simply adding the "exec " to the variable and set the SQLStatement to "?", but that also doesn't work.  Is this possible?  If not, is there perhaps a better way?

  • I figured it out.  You just have to set the SQLSourceType to Variable, and select the variable from the SourceVariable dropdown that appears.  Simple, once you know the option exists.

  • Thanks for answering your own question and glad you figured it out.

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

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