Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Viewing Output Parameters in Management Studio

Author  Topic 

robertc
Starting Member

7 Posts

Posted - 2007-11-17 : 00:05:32
I've yet to figure this out. But I tend to test my stored procs in the query window from time to time.

Some of these have output parameters, so when i'm trying to run the sproc it asks me to supply the output parameters which I find odd since i'm hoping to get something back rather than setting a value for them.

Does anyone know the syntax that will enable to me to run my sproc and view the results as well as the values of output Parameters?

Cheers

Rob

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2007-11-18 : 00:49:50
Hi
This can be done as follows

suppose you have a sp which is like this

Create Proc MyProc AS

@Param1 int
@Param2 varchar(10) OUTPUT

....
code
...

You can invoke the sp and get output variable value as follows

Declare @Var varchar(10) --this is for getting back sp return value

Exec MyProc {value of @Param1},@Var OUTPUT

Select @Var as 'Return Value'

and you will get return value of OUPUT param in query window

plzz note that the data type compatibility of user variable and output parameter.
Go to Top of Page
   

- Advertisement -