SQL Flow Field Guide

ALTER INDEX (Selective XML Indexes)

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

changes an index; CREATE/ALTER REBUILD sorts and writes all rows of the key

What changes

Input
table or view columns (key, included, filter predicate)
Output or change
index structure (B-tree, columnstore, XML, spatial, JSON, vector, full-text)

Syntax at a glance

ALTER INDEX index_name ON <table_object> [WITH XMLNAMESPACES ( <xmlnamespace_list> )] FOR ( <promoted_node_path_action_list> ) [WITH ( <index_options> )]

Work example

A selective XML index path needs a reviewed mapping change.

Compare the path map with current XQuery expressions and run each query against a lab copy.

Check your work The changed path resolves to the expected XML values and other indexed paths remain available.

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