SELECT Table name = case If A.colorder=1 then d.name else ' end, table description = case when a.colorder=1 then IsNull ( F.value, ') Else ' end,--field ordinal = a.colorder, field name = A.name, identity = case when ColumnProperty ( A.id,a.name, ' isidentity ') =1 then ' √ ' else ' end, primary key = case if exists (SELECT 1 from sysobjects where xtype= ' P K ' and Parent_obj=a.id and name in (the select name from the sysindexes WHERE indid in (select Indid from Sysindexkeys WHERE id = a.id and colid=a.colid)) Then ' √ ' Else ' end, type = b.name, number of bytes occupied = a.length, Length = ColumnProperty (a.id,a.name, ' PRECISION '), number of decimal digits = IsNull (ColumnProperty (a.id,a.name, ' scale '), 0), Allow NULL = case time a.isnullable=1 Then ' √ ' Else ' end, default = IsNull (E.text, '), Field description = IsNull (g.[val UE], ') from syscolumns a LEFT join systypes B on a.xusertype=b.xusertype inner join Sysobject S 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 left joins Sys.extended_properties F on D.ID=F.MAJOR_ID and F.minor_id=0--where d.name= ' c_party_spreader '--if only the specified table is queried, add this condition to order by A.id,a.colo Rder
Queries the structure of all database tables, which is executed directly inside the new query, and the cold dragon turns from Elf