SQL Flow Field Guide

@@SPID

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

reads configuration (@@ function)

What changes

Input
server or session configuration state
Output or change
value
Return type
smallint

Syntax at a glance

@@SPID

Work example

Label the current session during a short-lived blocking investigation.

Read in the same session and compare before and after a controlled session setting change.

Check your work A session id can be reused and is not a durable user or request identifier.

Open Microsoft Learn for full syntax, permissions, and details for your version.