SELECT * from Information_schema.columns WHERE table_name= ' account '
SELECT
(Case time A.colorder=1 then d.name Else ' end) as table name,--returns null if the table name is the same
A.colorder as Field ordinal,
A.name as field name,
(Case is ColumnProperty (a.id,a.name, ' isidentity ') =1 then ' √ ' else ' end) as identification,
(Case if (SELECT count (*) from sysobjects--query primary key
WHERE (name in
(SELECT name from sysindexes
WHERE (id = a.id) and (Indid in
(SELECT indid from Sysindexkeys
WHERE (id = a.id) and (Colid in
(SELECT colid from syscolumns
WHERE (id = a.id) and (name = A.name))
)))))
and (xtype = ' PK ')) >0 then ' √ ' else ' end) as primary key,--query primary key end
B.name as type,
A.length as takes up the number of bytes,
ColumnProperty (a.id,a.name, ' PRECISION ') as length,
IsNull (ColumnProperty (a.id,a.name, ' scale '), 0) as decimal digits,
(Case time a.isnullable=1 then ' √ ' else ' end) as allows NULL,
IsNull (E.text, ') as default value,
IsNull (G.[value], ') as field 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 Join Sys.extended_properties G
On a.id=g.major_id and a.colid = g.minor_id
ORDER BY A.id,a.colorder
SQL Server queries the database for all table names + fields