Created
April 9, 2017 20:38
-
-
Save alex-titarenko/3956eba54a79df19c547106d53240276 to your computer and use it in GitHub Desktop.
Get useful information about database tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @t table (name varchar (255), | |
[rows] varchar(255), | |
reserved varchar(255), | |
data varchar (255), | |
index_size varchar( 255), | |
unused varchar(255 )) | |
delete from @t | |
insert into @t exec sp_MSforeachtable @command1 ='EXEC sp_spaceused ''?''',@whereand= 'or OBJECTPROPERTY(o.id, N''IsSystemTable'') = 1' | |
select * | |
from @t | |
order by CONVERT( bigint,REPLACE (data, ' KB','')) DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment