SQL SERVER 查询一个表有多少列

select count(1) from syscolumns where id = object_id('tbname')
或者
select * from syscolumns where id = object_id('tbname')
或
SELECT MAX(colid) FROM syscolumns WHERE id=OBJECT_ID('table')

 

posted @ 2015-01-24 20:43  沙耶  阅读(1981)  评论(0编辑  收藏  举报