@@SPID (T-SQL)

Returns the server process ID of the current user process.

Syntax

@@SPID

Return Types

smallint

Remarks

@@SPID can be used to identify the current user process in the output of sp_who.

Examples

This example returns the process ID, login name, and username for the current user process.

SELECT @@SPID AS 'ID', SYSTEM_USER AS 'Login Name', USER AS 'User Name'

  

Here is the result set:

ID     Login Name       User Name 

-----  -------------    -----------

11     sa               dbo       

  

See Also
sp_lock Configuration Functions
sp_who  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.