Skip to content

Instantly share code, notes, and snippets.

@smarenich
Created October 19, 2015 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarenich/2bed3c419ba137b65366 to your computer and use it in GitHub Desktop.
Save smarenich/2bed3c419ba137b65366 to your computer and use it in GitHub Desktop.
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