|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, October 30, 2012 7:36 PM
Points: 148,
Visits: 69
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Saturday, November 13, 2010 7:59 PM
Points: 1,
Visits: 1
|
|
Sorry for the three year old reply,
You are right, it is a bit complicated. Your method may not return the columns in the correct order. Might I suggest:
USE Case_Management SELECT o.name, c.name FROM sysindexes ix JOIN sysobjects o ON ix.id = o.id JOIN sysobjects pk ON ix.name = pk.name AND pk.parent_obj = ix.id AND pk.xtype = 'PK' JOIN sysindexkeys ixk on ix.id = ixk.id AND ix.indid = ixk.indid JOIN syscolumns c ON ixk.id = c.id AND ixk.colid = c.colid WHERE o.name = 'MAIL_MESSAGES' ORDER BY ixk.keyno
Art
|
|
|
|