SELECT 
        i.name AS IndexName,
        OBJECT_NAME(ic.OBJECT_ID) AS TableName,
        COL_NAME(ic.OBJECT_ID,ic.column_id) AS ColumnName
FROM   
        SYS.INDEXES AS i INNER JOIN
        SYS.INDEX_COLUMNS AS ic ON  i.OBJECT_ID = ic.OBJECT_ID                                 AND i.index_id = ic.index_id WHERE   i.is_primary_key = 1

Comments (0)