Get Session ID

To get the session ID, simply use the intrinsic variable @@SPID:

[cc lang=”sql”]
SELECT @@SPID
[/cc]

The acronym for SPID means Server Process ID. It is synonymous with session.

5 comments
Billy Makovic 06 Aug 2014 at 6:48 am

how can i get my sesion id

Avery 27 Jul 2014 at 3:26 am

if this works thanks!
:)))

Avery 27 Jul 2014 at 3:25 am

if this works thanks!

ronjethro molano 23 Feb 2014 at 10:41 am

what is my session id?

Ben 14 Jul 2011 at 10:43 pm

whenever I rebuild index on SQL 2008, my process is blocked by session id -2. I could not find where this process is.

Need your assistance badly.

Thanks.
Ben

Featured Articles

 Site Author

  • Thanks for visiting!
css.php