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
全站熱搜
留言列表