CONTEXT_INFO
reads session state
What changes
- Input
- session CONTEXT_INFO bytes
- Output or change
- varbinary(128)
- Return type
- The context_info value. If context_info was not set: SQL Server returns NULL. SQL Database returns a unique session-specific GUID.
Syntax at a glance
CONTEXT_INFO()
Work example
Read the legacy session context binary value set by an application.
Read state in the intended scope and immediately after the statement it describes. Treat host values as untrusted.
Check your work Keep payload format and size explicit and prefer SESSION_CONTEXT for new key-value use.
Open Microsoft Learn for full syntax, permissions, and details for your version.