dbTalk Databases Forums  

DTS Output Parameter Mapping

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS Output Parameter Mapping in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Eric Marthinsen
 
Posts: n/a

Default DTS Output Parameter Mapping - 08-21-2006 , 11:40 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


Reply With Quote
  #2  
Old   
Charles Kangai
 
Posts: n/a

Default RE: DTS Output Parameter Mapping - 08-22-2006 , 03:15 AM






See this site:
http://www.sqldts.com/default.aspx?234

Charles Kangai, MCT, MCDBA


"Eric Marthinsen" wrote:

Quote:
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


Reply With Quote
  #3  
Old   
Eric Marthinsen
 
Posts: n/a

Default RE: DTS Output Parameter Mapping - 08-22-2006 , 05:37 AM



Yeah, that's where I got the technique from. Unfortunately, it just isn't
working for me. I'm totally stumped.

"Charles Kangai" wrote:

Quote:
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


Reply With Quote
  #4  
Old   
Eric Marthinsen
 
Posts: n/a

Default RE: DTS Output Parameter Mapping - 08-22-2006 , 05:42 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.



"Charles Kangai" wrote:

Quote:
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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.