SQL Server @@SPID
SQL Server @@SPID is a SQL Server configuration function that is used to return the session id of current user process.
Return type of @@SPID is smallint.
Following statement uses @@SPID function to return the session id for current user process in SQL Server.
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 you are using 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.
You can see, it returns the session information (for session Id – 63)