Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
create table #space
tn varchar(128),
rows varchar(128),
reserved varchar(128),
data varchar(128),
indexp varchar(128),
unused varchar(128)
insert #space
exec sp_msforeachtable 'exec sp_spaceused ''?'''
select * from #space order by convert(int, substring(reserved, 1, len(reserved)-3)) desc
drop table #space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.