dbTalk Databases Forums  

SQLTask - capture procedure return code

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


Discuss SQLTask - capture procedure return code in the microsoft.public.sqlserver.dts forum.



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

Default SQLTask - capture procedure return code - 01-11-2004 , 03:52 PM






I know how to pass values in as parameters to a stored procedure and receive
the resulting recordset using global variables. What I need to capture is
the return code from the stored procedure as that's where our error codes
are kept. How do you capture a "return" statement's value in a stored
procedure using a DTS SQL Task?



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

Default Re: SQLTask - capture procedure return code - 01-11-2004 , 04:20 PM






Imagine I have this stored proc

CREATE PROCEDURE ReturnSomething
AS
RETURN 4

In my ExecuteSQL task I would do this

declare @rtn int
exec @rtn = ReturnSomething
select @rtn as SomethingReturned

You map the SomthingReturned to an Output GlobalVariable



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"TMN" <tmn313 (AT) hotmail (DOT) com> wrote

Quote:
I know how to pass values in as parameters to a stored procedure and
receive
the resulting recordset using global variables. What I need to capture is
the return code from the stored procedure as that's where our error codes
are kept. How do you capture a "return" statement's value in a stored
procedure using a DTS SQL Task?





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.