检测SQL Server表占用空间大小SQL,要先选择需要查询的数据库,然后点击执行下面脚本。
CREATE TABLE #T (NAME nvarchar ( 200 ),ROWS char ( 11 ),reserved varchar ( 18 ) ,Data varchar ( 18 ) ,index_size varchar ( 18 ) ,Unused varchar ( 18 ) ) GO INSERT #T EXEC SP_MSFOREACHTABLE ' EXEC sp_spaceused "?" ' SELECT * FROM #T ORDER BY CONVERT ( INT , REPLACE (DATA, ' KB ' , '' )) DESC drop table #T