Groups | Blog | Home
all groups > sql server dts > august 2006 >

sql server dts : DTS Output Parameter Mapping


Eric Marthinsen
8/21/2006 9:40:02 PM
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
Charles Kangai
8/22/2006 1:15:58 AM
See this site:
http://www.sqldts.com/default.aspx?234

Charles Kangai, MCT, MCDBA


[quoted text, click to view]
Eric Marthinsen
8/22/2006 3:37:02 AM
Yeah, that's where I got the technique from. Unfortunately, it just isn't
working for me. I'm totally stumped.

[quoted text, click to view]
Eric Marthinsen
8/22/2006 3:42:01 AM
Ah ha.

I didn't read to the bottom of that article before, so I missed the bit
about SET NOCOUNT ON. Setting it did the trick.

Thanks.



[quoted text, click to view]
AddThis Social Bookmark Button