SQL Server @@SPID is a SQL Server configuration function that is used to return the session id of current user process.
SYNTAX
@@SPID
Return type of @@SPID is smallint.
Following statement uses @@SPID function to return the session id for current user process in SQL Server.
SELECT @@SPID
As you can see, It returns the session id for current user process is 63.
You can also check the session id in query window, check your query editor window tab that is being used by you currently.
You will get a session id within opening and closing brackets as shown in below screenshot, a session id is displaying as (63).
There is one more way to see the session id for current user process, just look at the right bottom corner of query window that you are currently using, you will get session id within opening and closing brackets as shown in below screenshot.
In SQL Server,ย Sp_who system stored procedures also returns the session Id information.
EXEC SP_WHO
You can see, it returns the session information (for session Id – 63)
Also Read..
2,930 total views, 1 views today