同事提供的方法,
主要是利用到內建的 stored procedure: sp_MSforeachtable
---
CREATE TABLE #TableSizes
(
table_name SYSNAME,
row_count int,
reserved_size varchar(10),
data_size varchar(10),
index_size varchar(10),
unused_size varchar(10)
)
INSERT #TableSizes EXEC sp_MSforeachtable 'sp_spaceused ''?'''
SELECT table_name,row_count, replace(reserved_size,' KB','') reserved_size,replace(data_size,' KB','') data_size, replace(index_size,' KB','') index_size, replace(unused_size,' KB','') unused_size FROM #TableSizes ORDER BY table_name
drop table #TableSizes
go
2009-05-12
MS SQL Table 佔用空間計算
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言