![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello- I want to use the Execute SQL task to run a stored procedure, then save an output parameter of that stored proc into a global variable. Here's how I set it up. I created a global variable called gGroupID. I added an Execute SQL Task and used the following as the SQL statement: DECLARE @returnVal INT EXEC spPopulateProcessingData @returnVal OUTPUT SELECT @returnVal AS 'GroupID' Then, I pressed the Parameters button and went to the Output Parameters tab, selected "Row Value" and mapped the Parameter GroupID to the output global variables gGroupID. I then added an ActiveX task to run on completion of the Execute SQL task with the following code in it (boilerplate removed): MsgBox DTSGlobalVariables("gGroupID").Value The messagebox always appears with the value 0 in it. For some reason, my global variable never gets set. If I run the sql statement in Query Analyzer, it works fine and it returns a valid value (not zero). Does anyone know what might be going on? Regards- Eric |
#3
| |||
| |||
|
|
See this site: http://www.sqldts.com/default.aspx?234 Charles Kangai, MCT, MCDBA "Eric Marthinsen" wrote: Hello- I want to use the Execute SQL task to run a stored procedure, then save an output parameter of that stored proc into a global variable. Here's how I set it up. I created a global variable called gGroupID. I added an Execute SQL Task and used the following as the SQL statement: DECLARE @returnVal INT EXEC spPopulateProcessingData @returnVal OUTPUT SELECT @returnVal AS 'GroupID' Then, I pressed the Parameters button and went to the Output Parameters tab, selected "Row Value" and mapped the Parameter GroupID to the output global variables gGroupID. I then added an ActiveX task to run on completion of the Execute SQL task with the following code in it (boilerplate removed): MsgBox DTSGlobalVariables("gGroupID").Value The messagebox always appears with the value 0 in it. For some reason, my global variable never gets set. If I run the sql statement in Query Analyzer, it works fine and it returns a valid value (not zero). Does anyone know what might be going on? Regards- Eric |
#4
| |||
| |||
|
|
See this site: http://www.sqldts.com/default.aspx?234 Charles Kangai, MCT, MCDBA "Eric Marthinsen" wrote: Hello- I want to use the Execute SQL task to run a stored procedure, then save an output parameter of that stored proc into a global variable. Here's how I set it up. I created a global variable called gGroupID. I added an Execute SQL Task and used the following as the SQL statement: DECLARE @returnVal INT EXEC spPopulateProcessingData @returnVal OUTPUT SELECT @returnVal AS 'GroupID' Then, I pressed the Parameters button and went to the Output Parameters tab, selected "Row Value" and mapped the Parameter GroupID to the output global variables gGroupID. I then added an ActiveX task to run on completion of the Execute SQL task with the following code in it (boilerplate removed): MsgBox DTSGlobalVariables("gGroupID").Value The messagebox always appears with the value 0 in it. For some reason, my global variable never gets set. If I run the sql statement in Query Analyzer, it works fine and it returns a valid value (not zero). Does anyone know what might be going on? Regards- Eric |
![]() |
| Thread Tools | |
| Display Modes | |
| |