November 6, 2014 at 1:44 pm
I have started work on a database created by someone else. I can see all the nonclustered indexes in the database by running this.
select object_name(object_id) as tablename, *
from sys.indexes where type_desc = 'NONCLUSTERED'
How can I see the actual syntax of the clustered index - so I can see what columns are being used in the index?
November 6, 2014 at 2:12 pm
November 6, 2014 at 3:53 pm
you can also join out to sys.index_columns
select
TableName = object_name(i.object_id),
IndexName = i.name,
ColumnName = col_name(i.object_id, ic.column_id)
from sys.indexes i
inner join sys.index_columns ic
on i.object_id = ic.object_id
and i.index_id = ic.index_id
November 8, 2014 at 4:19 am
Thank you for your help.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply