SQL Flow Field Guide

SESSIONPROPERTY

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

security context lookup

What changes

Input
security context (login, user, roles, permissions)
Output or change
name, id or boolean
Return type
sql_variant

Syntax at a glance

SESSIONPROPERTY (option)

Work example

Inspect a documented SET option for the current session.

Test under the intended execution context. Use GRANT and DENY rather than returned identity text.

Check your work Capture the option in the same session because each connection has independent settings.

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