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

 

 

posted @ 2021-08-27 16:30  普贤  阅读(494)  评论(0编辑  收藏  举报