SET CONTEXT_INFO
writes up to 128 bytes of session context (read by CONTEXT_INFO())
What changes
- Input
- none
- Output or change
- session state (CONTEXT_INFO bytes)
Syntax at a glance
SET CONTEXT_INFO { binary_str | @binary_var }
Work example
A session or module needs the behavior controlled by SET CONTEXT_INFO for a stated reason.
Check when SQL Server reads the option, its scope, and how a reused connection is reset. Change one setting at a time in a test session.
Check your work SET CONTEXT_INFO. The statement is affected by SET CONTEXT_INFO as intended and the setting does not leak into the next session task.
Open Microsoft Learn for full syntax, permissions, and details for your version.