CREATE TABLE #tmptb(tbname sysname,tbrows int 
,tbREserved varchar(10),tbData varchar(10) 
,tbIndexSize varchar(10),tbUnUsed varchar(10)) 
INSERT INTO #tmptb exec sp_MSForEachTable \'EXEC sp_spaceused \'\'?\'\'\' 
SELECT * from #tmptb --列出所有表的情况 
SELECT tbrows ,tbname FROM #tmptb WHERE tbrows=0 --列出记录数据为0的表 
ORDER BY tbrows,tbname 
DROP TABLE #tmptb 

 

版权声明:本文为shikyoh原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/shikyoh/archive/2012/07/16/2593082.html