SQL SERVER 获取数据库中所有的表名及表中的数据量代码如下:
select b.name as tablename , a.rowcnt as datacount from sysindexes a , sysobjects b where a.id = b.id and a.indid < 2 and objectproperty(b.id, 'IsMSShipped') = 0 order by datacount desc
查看每个数据库的链接打开数量,代码如下:
SELECT dbid,DB_NAME(dbid) as DBName,hostname,status,last_batch FROM master.sys.sysprocesses --WHERE DB_NAME(dbid)='查询数据库的名称' ORDER BY last_batch DESC