Home » SQL Server @@SPID

SQL Server @@SPID

SQL Server @@SPID




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 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.

EXEC SP_WHO

You can see, it returns the session information (for session Id – 63)

Also Read..

SQL Server @@version

SQL Server @@Language

SQL Basics TutorialSQL Advance TutorialSSRSInterview Q & A
SQL Create tableSQL Server Stored ProcedureCreate a New SSRS Project List Of SQL Server basics to Advance Level Interview Q & A
SQL ALTER TABLESQL Server MergeCreate a Shared Data Source in SSRSSQL Server Question & Answer Quiz
SQL DropSQL Server PivotCreate a SSRS Tabular Report / Detail Report
..... More.... More....More
Power BI TutorialAzure TutorialPython TutorialSQL Server Tips & Tricks
Download and Install Power BI DesktopCreate an Azure storage accountLearn Python & ML Step by stepEnable Dark theme in SQL Server Management studio
Connect Power BI to SQL ServerUpload files to Azure storage containerSQL Server Template Explorer
Create Report ToolTip Pages in Power BICreate Azure SQL Database ServerDisplaying line numbers in Query Editor Window
....More....More....More




 237 total views,  1 views today

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.