SQL Server 2008 Fetch method:--------------------------------------- SELECT Table name = case when 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, Field description = IsNull (G.[value], '), &N BSP; identity = case when ColumnProperty (A.id,a.name, ' isidentity ') =1 Then ' √ ' Else ' end, PRIMARY key = case when Exis TS (SELECT 1 from sysobjects Where xtype= ' PK ' and Parent_obj=a.id and name in ( &N Bsp SELECT name from 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, ') from syscolumns a  ; Left joins Systypes B on A.xusertype=b.xusertype inner joins sysobjects D on a.id=d.id and d.xtype= ' U ' and D.NAME<&G t; ' 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.major_id and F.minor_id=0 where D.name = ' Person ' order by a.id,a.colorder
SQL Server FETCH statement for table structure