[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 511
  • Last Modified:

DTS - How to pass a variable into an "Execute SQL task"


I am writing a DTS package that users will run from the command line.
I want them to be able to pass in a parameter at the cmd line that I can pass into a stored procedure via an Execute SQL task.
I have got my global variable setup to trap the incoming parameter and I can pass it in from the cmd line OK.  The problem is that I cant find a way of passing it into the prcoedure call.
Ultimately what I'm looking for is to be able to do this in the Execute SQL node :-
exec <procedure name> parameter1 = <DTS global variable>

How can I best do this?

Thanks in advance
1 Solution
In the Execute SQL Task Properties, enter your SQL statement to execute like this:

EXECUTE stpMyProcedure ?

(Note the "?" - you need one question mark for each dynamic parameter, comma separated)

Then click the Parameters... button and a box will appear with a list of parameters (Parameter 1.. etc) and you can choose the global variable from a drop down list that you want to use


Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now