sql查询表的所有字段和表字段对应的类型

时间:2024-11-07 17:55:13

1.查询表的所有字段

select from syscolumns where id=object_id('写上要查询的表名')

2.查询表的所有字段+表字段对应的类型

select , from syscolumns,systypes where =

and =object_id('写上要查询的表名')

3.查询表的所有字段+表字段对应的类型+类型的长度

select ,,+'('+cast(/2 as varchar(10))+')',

 

from syscolumns,systypes

where = and =object_id('写上要查询的表名')