SQL Query to list indexes

| | Comments (0) | TrackBacks (0)

Here’s a query for listing indexes… Needed this today…

select ‘tablename’=objectname(i.id) ,i.indid ,’indexname’=i.name ,i.groupid ,’filegroup’=f.name ,’filename’=d.physicalname ,’dataspace’=s.name from sys.sysindexes i ,sys.filegroups f ,sys.databasefiles d ,sys.dataspaces s where objectproperty(i.id,’IsUserTable’) = 1 and f.dataspaceid = i.groupid and f.dataspaceid = d.dataspaceid and f.dataspaceid = s.dataspaceid order by f.name,objectname(i.id),groupid go

0 TrackBacks

Listed below are links to blogs that reference this entry: SQL Query to list indexes.

TrackBack URL for this entry: http://www.brainlitter.com/cgi-bin/mt/mtb.cgi/277

Leave a comment