SELECT Table name = Case When. colorder = 1 Then D. name Else ''end, table description = Case When. colorder = 1 Then isnull (F. value, '') Else'' End, FIELD No. =. colorder, field name =. name, field description = isnull (G. [value], ''), id = Case When COLUMNPROPERTY (. id,. name, 'isidentity ') = 1 then' √ 'else' End, primary key = Case When exists (SELECT 1 FROM sysobjects Where xtype = 'pk' and parent_obj =. id and name in (SELECT name FROM sysindexes WHERE indid in (SELECT indid FROM sysindexkeys WHERE id =. id AND colid =. colid) then '√ 'else' 'end, type = B. name, in bytes =. length, Length = COLUMNPROPERTY (. id,. name, 'precision '), decimal point = isnull (COLUMNPROPERTY (. id,. name, 'Scale'), 0), allow null = Case When. isnullable = 1 then' √ 'else' End, default value = isnull (E. text, '') FROM syscolumns A Left Join policypes B On. xusertype = B. xusertype Inner Join sysobjects D On. id = D. id and D. xtype = 'U' and D. name <> 'dtproperties' Left Join syscomments E on. cdefault = E. id Left Join sys. extended_properties G on. id = G. major_id and. colid = G. minor_id Left Join sys. extended_properties F On D. id = F. major_id and F. minor_id = 0 -- where d. name = 'orderinfo' -- if only the specified table is queried, add this condition Order By. id,. colorder