dbTalk Databases Forums  

Execute SQL Output Param

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


Discuss Execute SQL Output Param in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ramandeep Singh
 
Posts: n/a

Default Execute SQL Output Param - 07-10-2003 , 05:25 PM






Hi Everyone,

Okay, I have the following sql in my SQL Task:

------------------------------------------------------------------
declare @Inserts int, @RowsAffected int
exec usp_dts_masternet_init @Inserts output, @RowsAffected output

update temp_tbl set value1 = @Inserts, value2 = @RowsAffected
where type = 'TRANS01'

select @Inserts AS Ins, @RowsAffected AS Upd
------------------------------------------------------------------

And then in my Parameters... > Output Parameters I have mapped 'Ins' and
'Upd' to my global variables called 'gvInserts' and 'gvUpdated'
respectivitly. It should work right? Well in my dts (after this step) I
use these global variables in ActiveX to write to log file. But the problem
is that these global variables are always empty. Any ideas??

I know that the proc is returning the output prams b/c when I do the update
into temp_tbl table I see the values there.

Thanks,

Raman



Reply With Quote
  #2  
Old   
Ramandeep Singh
 
Posts: n/a

Default Re: Execute SQL Output Param - 07-11-2003 , 04:24 AM






Thanks Allan, actually I used this article as a reference but it does not
help. I've followed exactly that with no such luck. I did some more
investigating and am finding that when I set my global variables from the
execute sql output prams with "Row Value" as the output parameter type--it
doesn't set the global variable value there. Am I missing some other
setting?? Or do I need to set some property to the dts itself?? I'm using
sql server 2000 sp3


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Does this article help

Global Variables and Stored Procedure Parameters
http://www.sqldts.com/default.aspx?6,102,234,0,1

--


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"Ramandeep Singh" <ramandeepuh (AT) hotmail (DOT) com> wrote in message
news:e8AsCJzRDHA.704 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi Everyone,

Okay, I have the following sql in my SQL Task:

------------------------------------------------------------------
declare @Inserts int, @RowsAffected int
exec usp_dts_masternet_init @Inserts output, @RowsAffected output

update temp_tbl set value1 = @Inserts, value2 = @RowsAffected
where type = 'TRANS01'

select @Inserts AS Ins, @RowsAffected AS Upd
------------------------------------------------------------------

And then in my Parameters... > Output Parameters I have mapped 'Ins' and
'Upd' to my global variables called 'gvInserts' and 'gvUpdated'
respectivitly. It should work right? Well in my dts (after this step)
I
use these global variables in ActiveX to write to log file. But the
problem
is that these global variables are always empty. Any ideas??

I know that the proc is returning the output prams b/c when I do the
update
into temp_tbl table I see the values there.

Thanks,

Raman







Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Execute SQL Output Param - 07-11-2003 , 05:09 AM



Here is what I did in QA (1,2)

*1*
CREATE PROCEDURE MyRtnOut @val varchar(20) OUTPUT
AS
SET @val = 'Hello'

*2*
declare @a varchar(20)

Exec MyRtnOut @a output

select @a as ComingOut


I then copied and pasted 2 into an ExecuteSQL task and assigned the Output
parameter to a GV defined as a string with a starting value of "No Val Yet"

Works for me.



--


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"Ramandeep Singh" <ramandeepuh (AT) hotmail (DOT) com> wrote

Quote:
Thanks Allan, actually I used this article as a reference but it does not
help. I've followed exactly that with no such luck. I did some more
investigating and am finding that when I set my global variables from the
execute sql output prams with "Row Value" as the output parameter type--it
doesn't set the global variable value there. Am I missing some other
setting?? Or do I need to set some property to the dts itself?? I'm using
sql server 2000 sp3


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:%23GXF8Y3RDHA.940 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Does this article help

Global Variables and Stored Procedure Parameters
http://www.sqldts.com/default.aspx?6,102,234,0,1

--


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

"Ramandeep Singh" <ramandeepuh (AT) hotmail (DOT) com> wrote in message
news:e8AsCJzRDHA.704 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi Everyone,

Okay, I have the following sql in my SQL Task:

------------------------------------------------------------------
declare @Inserts int, @RowsAffected int
exec usp_dts_masternet_init @Inserts output, @RowsAffected output

update temp_tbl set value1 = @Inserts, value2 = @RowsAffected
where type = 'TRANS01'

select @Inserts AS Ins, @RowsAffected AS Upd
------------------------------------------------------------------

And then in my Parameters... > Output Parameters I have mapped 'Ins'
and
'Upd' to my global variables called 'gvInserts' and 'gvUpdated'
respectivitly. It should work right? Well in my dts (after this
step)
I
use these global variables in ActiveX to write to log file. But the
problem
is that these global variables are always empty. Any ideas??

I know that the proc is returning the output prams b/c when I do the
update
into temp_tbl table I see the values there.

Thanks,

Raman









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.