|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Displaying output parameter in query analyzerHi,
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 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 > > 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 -- Show quoteArnie Rowland, Ph.D. Westwood Consulting, Inc Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous "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 > > |
|||||||||||||||||||||||