Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Monitor database growth - a better way for sp_spaceused

By Gaby Abed, 2013/05/24

This script is for anyone who has had issues in capturing the output from sp_spaceused, which returns two rows of different number of columns, therefore making it hard to capture into a table easily. I ran exec sp_helptext sp_spaceused and found the section where the two rows returned (I'm still confused why there are two select statements, one after the other, that don't have to be separated).

I did not keep the @updateusage portion of sp_spaceused and neither did I try to preserve the table check either via @objname (not needed for my purposes)

 

UPDATE: Oct 22, 2008 - Had a superflous variable here and there, so just cleaned up the code.

Total article views: 3778 | Views in the last 30 days: 35
 
Related Articles
FORUM

sp_spaceused

sp_spaceused

FORUM

spaceused of a table

spaceused query...

BLOG

sp_spaceused system-stored procedure

You can use the sp_spaceused system-stored procedure to return space usage information about a datab...

FORUM

sp_spaceused returns same even after deleteing 3.5 lac records.

sp_spaceused returns same even after deleteing 3.5 lac records.

SCRIPT

The joy of sp_spaceused

This script uses a cursor to loop through all tables and get the count and table sizes using sp_spac...

Tags
database size    
growth    
monitoring    
sp_spaceused    
sql server 2005    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones