Browsed by
Month: January 2008

Get the size of your tables

Get the size of your tables

Recently my boss asked me, why the databases (Microsoft SQL Server 2005) of our customers are so big. With the following SQL-Statements I could give more or less an answer to my boss. CREATE TABLE PW_SPACE( name varchar(255), rows int, reserved varchar(255), data varchar(255), index_size varchar(255), unused varchar(255) ) GO EXEC sp_MSforeachtable @command1=”INSERT INTO PW_SPACE EXEC sp_spaceused ‘?'” GO select * from PW_SPACE order by rows desc GO select sum(rows) as Rows, convert(varchar(255), sum(convert(int, substring(data,0,len(data)-2)))) + ‘ KB’ as Data,…

Read More Read More