Get table structure in SQL Server2008 with SQL
New data user, the role is public. Mapped to the database on which the table structure is to be obtained, granting the user's identity on the database as db_owner
Run SQL statements such as the following:
Select Syscolumns.name as [name], systypes.name as [type],syscolumns.length as [Size],syscolumns.xprec as [Precision], is Null (Syscolumns.scale, 0) as [scale],sys.extended_properties.value as [mark],syscolumns.isnullable as [NULL], (case When exists (select 1 from sysobjects inner joins sysindexes on sysindexes.name = sysobjects.name INNER JOIN Sysindexkeys On sysindexes.id = sysindexkeys.id and Sysindexes.indid = sysindexkeys.indid where xtype= ' PK ' and parent_obj = Syscolumn S.id and sysindexkeys.colid = syscolumns.colid) then 1 else 0 end) as [PK], (case syscolumns.status when 1 els e 0 end) as [Identity] from syscolumns inner join systypes on (Syscolumns.xtype = Systypes.xtype and Systypes.name & Lt;> ' _default_ ' and systypes.name<> ' sysname ') left outer join sys.extended_properties on (sys.extended_pro Perties.major_id=syscolumns.id and minor_id=syscolumns.colid) where syscolumns.id = (select id from sysobjects where Name= ' Nds_tfileform ') Order BYSyscolumns.colid
Get table structure in SQL Server2008 with SQL