Created
February 26, 2019 08:36
-
-
Save cpoDesign/8f36fbcce728dfbcb8e1edfbf313ce99 to your computer and use it in GitHub Desktop.
Find an index with a specific name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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