sqlserver查询表大小
时间:2021-07-01 10:21:17
帮助过:213人阅读
OBJECT_ID(
‘tempdb..#TB_TEMP_SPACE‘)
IS NOT NULL DROP TABLE #TB_TEMP_SPACE
GO
CREATE TABLE #TB_TEMP_SPACE(
NAME VARCHAR(
500)
,ROWS INT
,RESERVED VARCHAR(
50)
,DATA VARCHAR(
50)
,INDEX_SIZE VARCHAR(
50)
,UNUSED VARCHAR(
50)
)
GO
SP_MSFOREACHTABLE ‘INSERT INTO #TB_TEMP_SPACE exec sp_spaceused ‘‘?‘‘‘
GO
SELECT *
FROM #TB_TEMP_SPACE
ORDER BY REPLACE(DATA,
‘KB‘,
‘‘)
+0 DESC
GO
sqlserver查询表大小
标签:des object_id log varchar div for arc select har