DECLARE @spid int , @retcode int , @sp varchar( 30 );
SELECT @spid = 2 , @sp = 'sp_who';
EXEC @retcode = @sp @spid;
-- Sample output:
/*
spid status loginame hostname blk dbname cmd
------ ------------------------------ -------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------- ----- -------------------------------------------------------------------------------------------------------------------------------- ----------------
2 background sa 0 Forum Related Work LOCK MONITOR
*/
SELECT @retcode AS ReturnCode;
/*
ReturnCode
-----------
0
*/
This page was last updated on May 01, 2006 04:28 PM.