SELECT T.NAME AS TABLE_NAME, C.NAME AS COLUMN_NAME, K.COLID, I.NAME AS INDEX_NAME, I.INDID, K.KEYNO
FROM SYSINDEXES AS I LEFT JOIN SYSOBJECTS AS T ON I.ID = T.ID LEFT JOIN SYSINDEXKEYS AS K ON I.ID = K.ID AND I.INDID = K.INDID LEFT JOIN SYSCOLUMNS AS C ON I.ID = C.ID AND K.COLID = C.COLID
WHERE T.XTYPE = 'U' AND (I.NAME LIKE 'PK_%' OR I.NAME LIKE 'IX_%')
ORDER BY T.NAME, I.INDID, K.KEYNO, C.NAME
沒有留言:
張貼留言