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 tbname DROP TABLE #tmptb