Find columns used in indexes for SQL Server

Retrieves a number of information related to the structure of the available indexes
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
SELECT TableName =, IndexName =, ColumnName =, FGName =, ic.is_descending_key, ic.is_included_column, ind.is_unique, ind.type_desc, ic.* FROM sys.indexes ind INNER JOIN sys.index_columns ic ON ind.object_id = ic.object_id and ind.index_id = ic.index_id INNER JOIN sys.columns col ON ic.object_id = col.object_id and ic.column_id = col.column_id INNER JOIN sys.tables t ON ind.object_id = t.object_id INNER JOIN sys.[filegroups] f ON f.[data_space_id] = ind.data_space_id WHERE ind.is_unique_constraint = 0 AND t.is_ms_shipped = 0 ORDER BY,, ind.index_id, ic.index_column_id
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus