Discussion:
Passing variable to DTS from Stored Proc.
(too old to reply)
Joe
2008-11-14 15:59:36 UTC
Permalink
I have been following Darren Green's excellent article on executing
DTS packages from SPs... I am stuck now though, I have everything
working great, except that I cannot pass a variable from the SP to the
DTS package,

When I set the GlobalV_1 var on execute, I am only able to hardcode
the value in there, instead of using a variable from the SP.

@GlobalV_1='VariableName=VariableValue'

I tried this,

@GlobalV_1='gOldEmpID=' + @OldEmpID + ''

But this returns a "Line 1: Incorrect syntax near '+'." error.

How can I use my variables to pass to the DTS?

Thanks,
Drew
Joe
2008-11-14 16:50:02 UTC
Permalink
I figured this out. I needed to declare 2 new variables and build
them and use them as the variable to pass,

For example,

SET @OldEmpID = 'xx381281'
SET @Global_OldEmpID = 'gOldEmpID=' + @OldEmpID

@GlobalV_1=@Global_OldEmpID

That works perfectly.

Thanks,
Drew

Loading...