Sunday, 20 April 2014

Find all tables size in a database.

Follow below script and you can specify like operator for that tables you want. For example I want onlt that table that start with load



DECLARE @space_table TABLE (table_name varchar(500), row_count int, reserved varchar(500)
, data varchar(500), index_size varchar(500), unused varchar(500))
INSERT INTO @space_table(table_name, row_count, reserved, data, index_size, unused)
EXEC sp_MSforeachtable 'sp_spaceused ''?'''


SELECT * FROM @space_table where table_name like ‘Load%’

No comments:

Post a Comment