SELECT (CASE WHEN A.COLORDER = 1 THEN D.NAME ELSE '' END) N 'Name', A.COLORDER N 'Field Series', A.Name N' Field Name, (Case When ColumnProperty (A.ID , a.name, 'isidentity') = 1 Ten '√'lse' 'end) N' Identification '(Case When (Select Count (*) from sysobjects where (select name from sysindexes where (id = A) .id) and (SELECT Indid from sysindexkeys where (id = a.id) AND (Colid in (select colid from syscolumns where (id = a.id) and (name = a.name)))))))))))) )> 0 THEN '√' else '' end) n 'primary key', B.Name n 'type', A.Length N 'occupies bytes', ColumnProperty (A.ID) , A.Name, 'Precision') AS N 'Length', ISNULL (ColumnProperty (A.ID, A.NAME, 'Scale'), 0) AS N 'Digital Number (Case When A.isnullable = 1 THEN '√'ELSE' 'end) N' Allows empty ', isnull (e.text,' ') n' default ', isnull (g. [value],' ') AS n' field description '--into ## tx
From syscolumns a left a.xtype = B.XUSERTYPEINNER JOIN SYSOBJECTS D on A.ID = D.ID and D.XTYPE = 'u' and d.name <> DTPROPERTIES'LEFT JOIN SYSCOMFAMFAMFAMENTS EON A. CDEFAULT = E.IDLEFT JOIN SYSPROPERTIES GON A. ID = g.id and a.colid = g.smallid Order by Object_name (A.ID), A.COLORDER