SqlServer查询表中各列名称、表中列数
发布时间:2015-06-05 来源:查字典编辑
摘要:查询表名为tb_menu的所有列名1selectnamefromsyscolumnswhereid=object_id('tb_menu')...
查询表名为tb_menu的所有列名
1select name from syscolumns where id=object_id('tb_menu')
查询表名为tb_menu的所有列名个数
1select count(name) from syscolumns where id=object_id('tb_menu')
或者
1
2
3select count(syscolumns.name)
from syscolumns ,sysobjects
where syscolumns.id=sysobjects.id and sysobjects.name = 'tb_menu'