SQL Server查询所有表的数据大小
IF OBJECT_ID('TEMPDB..#tmp')IS NOT NULL DROP TABLE #tmp create table #tmp(name nvarchar(100), rows int, reserved nvarchar(100), data nvarchar(100), index_size nvarchar(100), unused nvarchar(100)); EXEC sp_MSforeachtable 'insert into #tmp exec sp_spaceused "?"' select * from #tmp order by rows desc