Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

actual space used by data

Status
Not open for further replies.
Jun 27, 2001
837
US
I thought (and can't find now) there was a script you could run to show how much actual data your tables held vs their size. In other words, if I have a table with 20 fields and 18 are empty, what that non-used/wasted space would be.
 
Are you thinking about sp_spaceused? Check it out in the BOL, it might be what you are looking for.

-SQLBill
 
DOn't think that is it, I think the problem with that one is that is doesn't really calculate char fields in a realistic fashion
 
You can use the datalength function in a query to calcualte wasted space. Here is an example that calculates the wasted space in a single column of a table.

Select Wasted = Sum(datalength(PartNumber)-datalength(rtrim(PartNumber)))
From dbo.PartsList

If you want to get the best answer for your question read faq183-874 and faq183-3179.
Terry L. Broadbent - DBA
SQL Server Page:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top