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)
 Returned value from system stored procedure

Author  Topic 

neophyte226
Starting Member

7 Posts

Posted - 2011-12-08 : 12:39:05
How to capture "Current Service State" value after executing master.dbo.xp_servicecontrol 'QUERYSTATE', 'MSSQLServer'?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-08 : 12:53:14
put the result in a temporary table and then retrieve from there as shown below

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

neophyte226
Starting Member

7 Posts

Posted - 2011-12-08 : 13:09:51
Thank you but I'd take it there is no way to assign the return value directly to a variable?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-08 : 13:31:45
there's a way but for that procedure should use RETURN (@variable) inside it and data type should be integer.
Otherway is to return values through OUTPUT parameters

see

http://www.sqlteam.com/article/stored-procedures-returning-data

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -