查看SqlServer 数据库中各个表多少行 :
SELECT A.NAME ,B.ROWS FROM sysobjects A JOIN sysindexes B ON A.id = B.id WHERE A.xtype = 'U' AND B.indid IN(0,1) ORDER BY B.ROWS DESC
数据库磁盘占用量:
select name, CAST(convert(float,size) * (8192.0/1024.0)/1024 AS nvarchar)+'MB' AS CP from CDR.dbo.sysfiles
where name = 'CDR'