Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Find an index with a specific name
select * from sys.tables as t
inner join sys.columns as c
on t.object_id = c.object_id
inner join sys.index_columns as ic
on c.column_id = ic.column_id and c.object_id = ic.object_id
inner join sys.indexes as i
on ic.index_id = i.index_id and ic.object_id = i.object_id
WHERE t.name = 'table_name' AND i.name = 'index_name'
-- where t.name = 'table_name' and c.name = 'column_name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.