Tag:select occupancy identity types from join property .class case
select (case when a.colorder=1 then d.name else null end) table name, a.colorder field ordinal,a.name field name, (Case when columnproperty ( a.id,a.name, ' isidentity ') =1 then ' √ ' else ' end ' logo, (case when (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 occupies bytes, columnproperty (a.id,a.name, ' PRECISION ') as length, isnull (ColumnProperty (a.id,a.name, ' scale '), 0) as decimal place, (case when a.isnullable=1 then ' √ ' else ' end) allow null, isnull (E.text, ') default, 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 join 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 --where d.name= ' table to query ' --if you only query the specified table, add this condition order by a.id,a.colorder
SQL Server queries all columns under all tables and tables