-------------------------------------------------------the first query to see how many tables in the library, table names, and so on select * from INFORMATION_SCHEMA. TABLES;-------------------------------------------------------the second query searches for a detailed SELECT (case a.colorder=1 then D.name Else ' end ' as table name,--returns an empty a.colorder as field ordinal if the table name is the same, a.name as field name (case when ColumnProperty (A.id,a.nam E, ' isidentity ') =1 then ' √ ' else ' end as identifier (case when (SELECT count (*) from sysobjects--query primary key where (name in (the SELECT name from sysindexes WHERE (id = A.I d) 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 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, Isnu LL (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 joins syscomments E on a.cdefault=e.id left join S Ys.extended_properties g on a.id=g.major_id and a.colid = g.minor_id ORDER by A.id,a.colorder
The use of SQL SERVER INFORMATION_SCHEMA