PygamePygame07-14 06:24

SqlServer查询表中各列名称、表中列数

原文链接:http://www.cnblogs.com/yangwujun/p/5409017.html

查询表名为tb_menu的所有列名

select name from syscolumns where id=object_id('tb_menu')
查询表名为tb_menu的所有列名个数
select count(name) from syscolumns where id=object_id('tb_menu')
或者
select count(syscolumns.name)
from syscolumns ,sysobjects
where syscolumns.id=sysobjects.id and sysobjects.name = 'tb_menu'

转载于:https://www.cnblogs.com/yangwujun/p/5409017.html

程序之家二维码

000
评论