SQLDBA- Get the list of indices on table with columns and include columns
Below help us to get the list of indices on table with columns and include columns also. SELECT QUOTENAME(SCHEMA_NAME(t.schema_id)) AS SchemaName, QUOTENAME(t.name) AS TableName, QUOTENAME(i.name) AS IndexName, i.type_desc, i.is_primary_key, i.is_unique, i.is_unique_constraint, STUFF(REPLACE(REPLACE(( SELECT QUOTENAME(c.name) + CASE WHEN ic.is_descending_key = 1 THEN ' DESC' ELSE '' END AS [data()] FROM sys.index_columns AS ic INNER JOIN sys.columns AS c ON ic.object_id = c.object_id AND ic.column_id = c.column_id WHERE ic.object_id = i.object_id AND ic.index_id = i.index_id AND ic.is_included_column = 0 ORDER BY ic.key_ordinal FOR XML PATH ), '<row>', ', '), '</row>', ''), 1, 2, '') AS KeyC...