All databases in a server
SELECT * from Master. sysdatabases ORDER by Name
All the tables in a database
SELECT * from sysobjects WHERE xtype= ' u '
Description Information for a table
SELECT * from Sys.extended_properties a left JOIN sysobjects b on a.major_id=b.id WHERE b.name= ' Log '
--and a.minor_id =0
ORDER BY a.minor_id
All the field information in a table
SELECT (case if A.colorder=1 then d.name else null end) Table name,
A.colorder field ordinal, a.name field name,
(Case if ColumnProperty (a.id,a.name, ' isidentity ') =1 then ' √ ' else ' end) is identified,
(SELECT count (*) from sysobjects
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) primary key, B.name type, A.length takes up the number of bytes,
ColumnProperty (a.id,a.name, ' PRECISION ') as length,
IsNull (ColumnProperty (a.id,a.name, ' scale '), 0) as decimal place, (case time a.isnullable=1 then ' √ ' else ' end) allows null,
IsNull (E.text, ') default value, 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
--and d.name= ' Log '--the table you're looking for
ORDER BY A.id,a.colorder
SQL Get database table information