Select sysobjects. Name as [Table], sysproperties. [value] As table description,
Syscolumns. Name as field, properties. [value] As field description, policypes. Name as type,
Syscolumns. length, isnull (columnproperty (syscolumns. ID, syscolumns. Name,
'Scale'), 0) as decimal places, syscolumns. isnullable as isnull,
Case when syscomments. Text is null
Then ''else syscomments. Text end as [Default],
Case when columnproperty (syscolumns. ID, syscolumns. Name, 'isidentity ')
= 1 then '√ 'else' end as ID, case when exists
(Select 1
From sysobjects
Where xtype = 'pk' and name in
(Select name
From sysindexes
Where indid in
(Select indid
From sysindexkeys
Where id = syscolumns. ID and colid = syscolumns. colid )))
Then' √ 'else' end as primary key
From syscolumns inner join
Sysobjects on sysobjects. ID = syscolumns. ID inner join
Policypes on syscolumns. xtype = policypes. xtype left Outer Join
Sysproperties properties on syscolumns. ID = properties. ID and
Syscolumns. colid = properties. smallid left Outer Join
Sysproperties on sysobjects. ID = sysproperties. ID and
Sysproperties. smallid = 0 left Outer Join
Syscomments on syscolumns. cdefault = syscomments. ID
Where (sysobjects. xtype = 'U') order by [Table]