List table size script
Posted on: Tue Jun 14 11:44:08 -0700 2011. Updated on: Tue Jun 14 11:44:44 -0700 2011.
Category: SQL Server 2005
Category: SQL Server 2005
This is a super handy script that can be found in original source here: http://www.keyboardface.com/archives/2007/06/12/mssql-table-size-for-all-tables/
It basically lists all the tables with their sizes on your db
declare @RowCount int, @tablename varchar(100) declare @Tables table ( PK int IDENTITY(1,1), tablename varchar(100), processed bit ) INSERT into @Tables (tablename) SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_TYPE = 'BASE TABLE' and TABLE_NAME not like 'dt%' order by TABLE_NAME asc declare @Space table ( name varchar(100), rows nvarchar(100), reserved varchar(100), data varchar(100), index_size varchar(100), unused varchar(100) ) select top 1 @tablename = tablename from @Tables where processed is null SET @RowCount = 1 WHILE (@RowCount <> 0) BEGIN insert into @Space exec sp_spaceused @tablename update @Tables set processed = 1 where tablename = @tablename select top 1 @tablename = tablename from @Tables where processed is null SET @RowCount = @@RowCount END update @Space set data = replace(data, ' KB', '') update @Space set data = convert(int, data)/1000 update @Space set data = data + ' MB' update @Space set reserved = replace(reserved, ' KB', '') update @Space set reserved = convert(int, reserved)/1000 update @Space set reserved = reserved + ' MB' select * from @Space order by convert(int, replace(data, ' MB', '')) desc
Fri Aug 19 16:12:51 -0700 2011
Lots of specialists claim that <a href="http://bestfinance-blog.com/topics/credit-loans">credit loans</a> help people to live their own way, just because they are able to feel free to buy needed things. Furthermore, a lot of banks present collateral loan for young and old people.
---------------------------------------------------
Sun Dec 04 22:19:17 -0800 2011
Some specialists argue that credit loans help a lot of people to live the way they want, just because they can feel free to buy needed things. Moreover, various banks offer student loan for young and old people.
---------------------------------------------------