The following query will provide you with all the user tables, columns, data type, and if the column is part of the cluster index, it will return the sequence of columns / order in the encoded index, otherwise it will return NULL.
SELECT U.name [OWNER],O.name [TABLE_NAME],C.name [COLUMN_NAME],T.name [DATA_TYPE],C.length [DATA_LENGTH], x.keyno [Primary_Key_order] FROM syscolumns C inner join sysobjects O on O.Id=C.Id and o.xtype='U' -- User Tables inner join sysusers U on O.Uid=U.UID inner join systypes T on C.xtype=T.xtype left outer join (Select O.name [TABLE_NAME] , C.name [COLUMN_NAME], IK.keyno from syscolumns C inner join sysobjects O on O.Id=C.Id and O.xtype='U' -- User Tables join sysindexkeys IK on O.id=IK.ID and C.colid=IK.COLID and Indid=1 -- Only Clustered Index ) x on x.TABLE_NAME=O.name and X.COLUMN_NAME=C.name order by U.name
source share