user indexes | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

user indexes

Hi All, Sql server 7 Is there anyway of listing the indexes that are
present in a database.
TIA
Adil

The follwing script show you indexes and statistics. select si.rows as ‘Rows’, SO.Name as Tabla, SI.name as ‘Index’, SFG.groupname as ‘Filegroup’
from sysobjects as SO
join sysindexes as SI
on SO.Id = SI.id
join sysfilegroups as SFG
on SI.GroupId = SFG.GroupId order by SO.Name , SI.name, SFG.GroupName HTH Luis Martin
Moderator
SQL-Server-Performance.com
Try to avoid querying system tables directly when system SPs are supplied.
YOu can use SP_HELPINDEX or try to query INFORMATION SCHEMA views. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
quote:Originally posted by satya Try to avoid querying system tables directly when system SPs are supplied.
YOu can use SP_HELPINDEX or try to query INFORMATION SCHEMA views. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.

Well….don’t the views query the system catalog? And yes you should use them, but I haven’t found one for indexes per say… Any ideas? Brett :cool:
Brett T’was general recommendation by MS & other SQL Professionals to use information schema views and system supplied SPs wherever supplied. Using system tables directly may not have impact but future releases/Service packs might change the structure of table itself. If its a one-off then I have no comment to say, query directly. Satya SKJ
Moderator
http://www.SQL-Server-Performance.Com/forum
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
]]>