Friday, May 25, 2012

Script to display indexes

Select so.name as Table_Name, sc.name, si.name as Index_Name, si.type_desc
from sys.objects so, sys.indexes si, sys.columns sc, sys.index_columns sic
where so.object_id = si.object_id and sc.object_id = so.object_id and sic.object_id = so.object_id
and sic.column_id = sc.column_id and sic.index_id = si.index_id
and so.type_desc = 'USER_TABLE' and so.name = 'Address'

No comments: