select count(1) from syscolumns where id = object_id('tbname')
或者
select * 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')
-- 查询某张表有多少条数据
SELECT SUM(rows) AS counts FROM sys.partitions WHERE object_id = object_id(N'Com_User', N'U')
U是用户表
N代表unicode字符集
N代表unicode字符集