--这样? select count(name) from syscolumns where id=object_id('TableName')
EXEC sp_MSforeachtable ' select ''表名:?;记录数:'' +ltrim(count(*)) from ?'
--SQL 2000是这样的,2005中把系统表换一下就可以。 select b.name,a.rowcnt from sysindexes a,sysobjects b where a.id=b.id and a.indid<2 and b.xtype='u' --and rowcnt>100000
select rows from sysindexes where id in (select id from sysobjects where xtype = 'u') and indid in (0,1)
SELECT o.name AS "Table Name", i.rowcnt AS "Row Count" FROM sysobjects o, sysindexes i WHERE i.id = o.id AND i.indid IN(0,1) AND o.xtype = 'u' --只统计用户表 AND o.name <> 'sysdiagrams' ORDER BY i.rowcnt DESC --按行排降序COMPUTE SUM(i.rowcnt), count(o.name); --汇总行数,表数 GO
declare @TableRow table (tableName sysname, RowCnt int)insert into @TableRow exec sp_msforeachTable 'select ''?'', count(*) ''?_RowCnt'' from ?' select * from @TableRow order by RowCnt desc
select count(name) from syscolumns where id=object_id('TableName')
select b.name,a.rowcnt from sysindexes a,sysobjects b
where a.id=b.id and a.indid<2 and b.xtype='u' --and rowcnt>100000
and indid in (0,1)
FROM sysobjects o, sysindexes i
WHERE i.id = o.id
AND i.indid IN(0,1)
AND o.xtype = 'u' --只统计用户表
AND o.name <> 'sysdiagrams'
ORDER BY i.rowcnt DESC --按行排降序COMPUTE SUM(i.rowcnt), count(o.name); --汇总行数,表数
GO
declare @TableRow table
(tableName sysname,
RowCnt int)insert into @TableRow exec sp_msforeachTable 'select ''?'', count(*) ''?_RowCnt'' from ?'
select * from @TableRow
order by RowCnt desc