SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Detect the Amount of Wasted Data Space in a Table for 2000

By Brian Knight,

SP_WASTED_SPACE will run through each column in your database and print a report of all the character columns. It will then print a report with :

* The maximum length that a column is storing
* The average length of data stored in each column
* The amount of wasted space in each column
* Hints on how to improve performance

Create the stored procedure in the Master database. No parameters are needed if you do that since the procedure reads what database you're in. Just attach to the target database and then run SP_WASTED_SPACE

Will compile only in SQL Server 2000.

It may take some time to run on large active databases, so I would recommend running it on a copy of the database.

Total article views: 1103 | Views in the last 30 days: 1
Related Articles

Storing Image in the database Column

How to store the image from the vb.net to sql database column


Reclaiming Space After Column Data Type Change

A brief overview of how to reclaim storage space after altering the data type of a column.


Four Ways to Find Free Space In SQL Server Database

Determine Free Space In SQL Server Database In our previous section we have discussed about Using...


Remove Spaces in Columns

How to remove spaces in all columns


Monitoring Drive and Database Free Space

SQL Server will autogrow your databases as they run out of space. But the process doesn't manage spa...