Home All Groups Group Topic Archive Search About

Get return value of stored procedure in Query Analyzer

Author
17 Mar 2006 4:08 PM
dw
Hi. We've got a stored procedure on SQL Server 2000 with a Return statement,
and sending back a number. Is there a way to view the Return value when
executing this procedure in Query Analyzer? Right now, it's just displaying
how many rows were affected. Thanks.

Author
17 Mar 2006 4:14 PM
Jack Vamvas
What about a PRINT statement prior to your Return statement?
--
Jack Vamvas
___________________________________
Receive free SQL tips - www.ciquery.com/sqlserver.htm

Show quote
"dw" <cougarmana_NOSPAM_@uncw.edu> wrote in message
news:u3NDF0dSGHA.792@TK2MSFTNGP10.phx.gbl...
> Hi. We've got a stored procedure on SQL Server 2000 with a Return
statement,
> and sending back a number. Is there a way to view the Return value when
> executing this procedure in Query Analyzer? Right now, it's just
displaying
> how many rows were affected. Thanks.
>
>
Author
17 Mar 2006 4:15 PM
SQL
example
create proc prTestReturnValue
as
select getdate()
return 5
GO

declare @i int
exec @i =prTestReturnValue
select @i

http://sqlservercode.blogspot.com/
Author
17 Mar 2006 4:16 PM
Alejandro Mesa
dw,

declare @rv int

exec @rv = dbo.p1 ...

select @rv
go

See "execute" command/statement in BOL.


AMB

Show quote
"dw" wrote:

> Hi. We've got a stored procedure on SQL Server 2000 with a Return statement,
> and sending back a number. Is there a way to view the Return value when
> executing this procedure in Query Analyzer? Right now, it's just displaying
> how many rows were affected. Thanks.
>
>
>
Author
17 Mar 2006 4:41 PM
dw
Thank you all for the answers. That's what I needed and it worked
beautifully :)

Show quote
"Alejandro Mesa" <AlejandroM***@discussions.microsoft.com> wrote in message
news:AF2BF839-61D5-48FE-9845-11532AFB82CF@microsoft.com...
> dw,
>
> declare @rv int
>
> exec @rv = dbo.p1 ...
>
> select @rv
> go
>
> See "execute" command/statement in BOL.
>
>
> AMB
>
> "dw" wrote:
>
>> Hi. We've got a stored procedure on SQL Server 2000 with a Return
>> statement,
>> and sending back a number. Is there a way to view the Return value when
>> executing this procedure in Query Analyzer? Right now, it's just
>> displaying
>> how many rows were affected. Thanks.
>>
>>
>>

AddThis Social Bookmark Button