create table #Data(name varchar(100), row varchar(100), reserved varchar(100), data varchar(100), index_size varchar(100), unused varchar(100)) declare @name varchar(100) declare cur cursor forSELECT name FROM sysobjects WHERE xtype='u' ORDER BY name open cur fetch next FROM cur into @name while @@fetch_status=0 begin insert into #data exec sp_spaceused @name print @name fetch next FROM cur into @name END close cur deallocate cur create table #DataNew(name varchar(100), row int, reserved int, data int, index_size int, unused int) insert into #dataNewSELECT name, convert(int, row) AS row, convert(int, replace(reserved, 'KB','')) AS reserved,convert(int,replace(data,'KB','')) AS data, convert(int,replace(index_size,'KB','')) AS index_size,convert(int,replace(unused,'KB','')) AS unused FROM #dataSELECT * FROM #dataNew ORDER BY data DESC drop table #dataNew drop table #Data