declare @table_spaceused table (name nvarchar(100) ,rows int ,reserved nvarchar(100) ,data nvarchar(100) ,index_size nvarchar(100) ,unused nvarchar(100) ) insert into @table_spaceused (name,rows,reserved,data,index_size,unused ) exec sp_MSforeachtable @command1='exec sp_spaceused ''?''' select * from @table_spaceused