SQL @@SPID is one of the Configuration Function, which will return the session ID that is currently being used. Syntax behind this is
SQL @@SPID Example
Below code snippet will show you the SP ID, and their respective login name that is currently being used by SQL.
SELECT @@SPID AS 'SP ID', SYSTEM_USER AS 'Login Name', USER AS 'User Name';
Let me use another SQL Server login to enter into SQL Server Management Studio. Now you can see, it is displaying different SP ID, and login name
If you don’t know the list of available users, and their IDs then use sp_who system stored procedure.
Thank You for Visiting Our Blog