| title | sp_db_selective_xml_index (Transact-SQL) | ||
|---|---|---|---|
| description | sp_db_selective_xml_index enables and disables selective XML index (SXI) functionality on a SQL Server database. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | system-objects | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server]
Enables and disables selective XML index (SXI) functionality on a [!INCLUDE ssNoVersion] database. If called without any parameters, the stored procedure returns 1 if SXI is enabled on a particular database.
Note
In [!INCLUDE sssql14-md] and later versions, the SXI functionality can't be disabled. [!INCLUDE ssNoteDepFutureAvoid]
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_db_selective_xml_index
[ [ @dbname = ] N'dbname' ]
[ , [ @selective_xml_index = ] 'selective_xml_index' ]
[ ; ]
The name of the database on which to to enable or disable selective XML index. @dbname is sysname, with a default of NULL.
If @dbname is NULL, the current database is assumed.
Determines whether to enable or disable the index. @selective_xml_index is varchar(6), with a default of NULL, and can be one of the following values: ON, OFF, TRUE, or FALSE. Any other value raises an error.
1 if the SXI is enabled on a particular database, 0 if disabled.
The following example enables SXI on the current database.
EXECUTE sys.sp_db_selective_xml_index
@dbname = NULL,
@selective_xml_index = N'on';
GOThe following example enables SXI on the [!INCLUDE sssampledbobject-md] database.
EXECUTE sys.sp_db_selective_xml_index
@dbname = N'AdventureWorks2022',
@selective_xml_index = N'true';
GOThe following example disables SXI on the current database.
EXECUTE sys.sp_db_selective_xml_index
@dbname = NULL,
@selective_xml_index = N'off';
GOThe following example disables SXI on the [!INCLUDE sssampledbobject-md] database.
EXECUTE sys.sp_db_selective_xml_index
@dbname = N'AdventureWorks2022',
@selective_xml_index = N'false';
GOThe following example detects if SXI is enabled, and returns 1 if SXI is enabled.
EXECUTE sys.sp_db_selective_xml_index;
GO