| title | sys.query_context_settings (Transact-SQL) | ||||
|---|---|---|---|---|---|
| description | sys.query_context_settings contains information about the semantics affecting context settings associated with a query. | ||||
| author | rwestMSFT | ||||
| ms.author | randolphwest | ||||
| ms.date | 12/29/2025 | ||||
| ms.service | sql | ||||
| ms.subservice | system-objects | ||||
| ms.topic | reference | ||||
| ms.custom |
|
||||
| f1_keywords |
|
||||
| helpviewer_keywords |
|
||||
| dev_langs |
|
||||
| monikerRange | =azuresqldb-current || >=sql-server-2016 || =azure-sqldw-latest || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb |
[!INCLUDE sqlserver2016-asdb-asdbmi-asa-fabricsqldb]
Contains information about the semantics affecting context settings associated with a query. There are several context settings available in [!INCLUDE ssNoVersion] that influence the query semantics (defining the correct result of the query). The same query text compiled under different settings might produce different results (depending on the underlying data).
| Column name | Data type | Description |
|---|---|---|
context_settings_id |
bigint | Primary key. This value is exposed in Showplan XML for queries. |
set_options |
varbinary(8) | Bit mask reflecting state of several SET options. For more information, see sys.dm_exec_plan_attributes. |
language_id |
smallint | The ID of the language. For more information, see sys.syslanguages. |
date_format |
smallint | The date format. For more information, see SET DATEFORMAT. |
date_first |
tinyint | The date first value. For more information, see SET DATEFIRST. |
status |
varbinary(2) | Bitmask field that indicates type of query or context in which query was executed. Column value can be combination of multiple flags (expressed in hexadecimal): 0x0 - regular query (no specific flags)0x1 - query that was executed through one of the cursor APIs stored procedures0x2 - query for notification0x4 - internal query0x8 - auto parameterized query without universal parameterization0x10 - cursor fetch refresh query0x20 - query that's being used in cursor update requests0x40 - initial result set is returned when a cursor is opened (Cursor Auto Fetch)0x80 - encrypted query0x100 - query in context of row-level security predicate |
required_cursor_options |
int | Cursor options specified by the user such as the cursor type. |
acceptable_cursor_options |
int | Cursor options that [!INCLUDE ssNoVersion] might implicitly convert to in order to support the execution of the statement. |
merge_action_type |
smallint | The type of trigger execution plan used as the result of a MERGE statement.0 indicates a non-trigger plan, a trigger plan that doesn't execute as the result of a MERGE statement, or a trigger plan that executes as the result of a MERGE statement that only specifies a DELETE action.1 indicates an INSERT trigger plan that runs as the result of a MERGE statement.2 indicates an UPDATE trigger plan that runs as the result of a MERGE statement.3 indicates a DELETE trigger plan that runs as the result of a MERGE statement containing a corresponding INSERT or UPDATE action.For nested triggers run by cascading actions, this value is the action of the MERGE statement that caused the cascade. |
default_schema_id |
int | ID of the default schema, which is used to resolve names that aren't fully qualified. |
is_replication_specific |
bit | Used for replication. |
is_contained |
varbinary(1) | 1 indicates a contained database. |
Requires the VIEW DATABASE STATE permission.
- sys.database_query_store_options
- sys.query_store_plan
- sys.query_store_query
- sys.query_store_query_text
- sys.query_store_runtime_stats
- sys.query_store_wait_stats
- sys.query_store_runtime_stats_interval
- Monitor performance by using the Query Store
- System catalog views (Transact-SQL)
- Query Store stored procedures (Transact-SQL)
- sys.fn_stmt_sql_handle_from_sql_stmt