--Query database all
SELECT (case if A.colorder=1 then d.name else null end) Table name,
A.colorder field ordinal, a.name field name,
IsNull (G.[value], ") as [description]
From Syscolumns A
Left join Systypes B on A.xtype=b.xusertype
INNER JOIN sysobjects D on a.id=d.id and d.xtype= ' U ' and d.name<> ' dtproperties '
Left join syscomments E on a.cdefault=e.id
Left joins Sys.extended_properties G on a.id=g.major_id and a.colid=g.minor_id
Left join Sys.extended_properties F on D.id=f.class and f.minor_id=0
Where b.name is not null
ORDER BY A.id,a.colorder
--Querying a table
SELECT A.name as Fieldcode, ' T_exentryhead ' Tablename,isnull (G.[value], ') FieldName from syscolumns a
INNER JOIN sysobjects D on a.id=d.id and d.xtype= ' U ' and d.name<> ' dtproperties '
Left joins Sys.extended_properties G on a.id=g.major_id and a.colid=g.minor_id
where d.name = ' t_exentryhead '--table name
ORDER BY A.id,a.colorder
Querying the database for all (a) table field names, data types, descriptions, etc.