sqlserver中的表信息字段信息这些东西也是放到系统表中的,以下sql语句用于查询某表的字段信息。
select t1.name table_name,t2.name col_name,t3.name+‘(‘+convert(varchar(200),t2.length)+‘)‘ datatype,t2.isnullable from sysobjects t1 join syscolumns t2 on t2.id=t1.id join systypes t3 on t3.xtype=t2.xtype where t1.name=‘table_name‘ order by t2.colorder
finished