Search this insane blog:

Tuesday, June 24, 2008

Find Indexes on columns

SELECT OBJECT_NAME(sys.sysindexes.id) AS [object name], INDEX_COL(OBJECT_NAME(sys.sysindexes.id), sys.sysindexes.indid, 1) AS [column]



FROM sys.sysindexes
INNER JOIN



sys.sysobjects
ON sys.sysobjects.id = sys.sysindexes.id



WHERE (sys.sysobjects.xtype
IN ('u', 'v')) AND (sys.sysindexes.status
= 0) AND (INDEX_COL(OBJECT_NAME(sys.sysindexes.id), sys.sysindexes.indid, 1) IS NOT NULL)



ORDER BY [object name]

No comments:

Post a Comment