Home All Groups Group Topic Archive Search About

Displaying output parameter in query analyzer

Author
28 Jul 2006 8:08 PM
jerryk
Hi,

Sorry for the basic question, but how does one user and display the value of
a stored procedures  output parameter in Query Analyzer.

I tried the following:

Declare @ID int
exec myproc 1, 45, @ID
select @ID

I got NULL, when the result should have been a number.

Thanks,

jerry

Author
28 Jul 2006 8:18 PM
sloan
exec myproc 1, 45, @ID output

you almost had it!


Show quote
"jerryk" <jer***@insteptech.com> wrote in message
news:%23RpJcGosGHA.1192@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> Sorry for the basic question, but how does one user and display the value
of
> a stored procedures  output parameter in Query Analyzer.
>
> I tried the following:
>
> Declare @ID int
> exec myproc 1, 45, @ID
> select @ID
>
> I got NULL, when the result should have been a number.
>
> Thanks,
>
> jerry
>
>
Author
28 Jul 2006 8:23 PM
Arnie Rowland
Assuming that MyProc has 3 parameters defined, and the in the definition @ID is defined as OUTPUT, then by putting OUTPUT after @ID on the call should work.

DECLARE @ID int
EXECUTE MyProc 1, 45, @ID OUTPUT
SELECT @ID


--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


Show quote
"jerryk" <jer***@insteptech.com> wrote in message news:%23RpJcGosGHA.1192@TK2MSFTNGP04.phx.gbl...
> Hi,
>
> Sorry for the basic question, but how does one user and display the value of
> a stored procedures  output parameter in Query Analyzer.
>
> I tried the following:
>
> Declare @ID int
> exec myproc 1, 45, @ID
> select @ID
>
> I got NULL, when the result should have been a number.
>
> Thanks,
>
> jerry
>
>

AddThis Social Bookmark Button