Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Enterprise
Expertise: Beginner
Sep 29, 1999

Get a Rough Estimate of Disk Space for Data and Indexes

sp_spaceused can be used to compute the amount of disk space used for data and indexes, and the disk space used by a table in the current database. If no table is given, then sp_spaceused reports on the space used by the entire current database. For example:

sp_spaceused MyTable [, Optional true or false to
specify if DBCC UPDATEUSAGE is also run] go

A known limitation of this stored procedure is that it reports inaccurate information after an index is dropped. This is because this stored procedure queries the sysindexes table and is completely dependent on that table for its accuracy.

However, sp_spaceused can provide a quick, rough estimate of values. DBCC UPDATEUSAGE can be run to correct the inaccuracies if incorrect values are noticed when executing sp_spaceused. The stored procedure can also take an optional parameter to specify whether or not DBCC UPDATEUSAGE should be run. Another option is to run DBCC UPDATEUSAGE separately. To run DBCC UPDATEUSAGE with the stored procedure use: sp_spaceused MyTable, True.

Jai Bardhan
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date