IF OBJECT_ID('tempdb..#TB_TEMP_SPACE') IS NOT NULL DROP TABLE #TB_TEMP_SPACEGOCREATE TABLE #TB_TEMP_SPACE(NAME VARCHAR(500),ROWS INT,RESERVED VARCHAR(50),DATA VARCHAR(50),INDEX_SIZE VARCHAR(50),UNUSED VARCHAR(50))GOSP_MSFOREACHTABLE 'INSERT INTO #TB_TEMP_SPACE exec sp_spaceused ''?'''GOSELECT *FROM #TB_TEMP_SPACEORDER BY REPLACE(DATA,'KB','')+0 DESCGO