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!

sp_spaceused results question for 2 databases

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
I have a small script below which uses sp_MSforeachtable and sp_spaceused in combination to return the size in KB's of each user table in the database.
I run the script against my development and test databases which have approximately the same number of records in each user table.

CREATE TABLE #temp
(TableName NVARCHAR (128), RowsCnt VARCHAR (11), ReservedSpace VARCHAR(18),
DataSpace VARCHAR(18), CombinedIndexSpace VARCHAR(18), UnusedSpace VARCHAR(18))
EXEC sp_MSforeachtable 'INSERT INTO #temp (TableName, RowsCnt, ReservedSpace, DataSpace, CombinedIndexSpace, UnusedSpace)
EXEC sp_spaceused ''?'', FALSE'
SELECT TableName, RowsCnt, ReservedSpace, DataSpace, CombinedIndexSpace,
UnusedSpace
FROM #temp
ORDER BY TableName
DROP TABLE #temp

I export the results to a spreadsheet which sums the size of the dataspace and combinedindexspace for each table to give a total of around 1.5 MB for both Test and development.

If I execute sp_spaceused on its own it returns a database size of approx 252 MB for Development and 8 MB for Test. So how do I explain the difference in sizes. Is this a re-indexing issue?


Thanks


The risk with keeping an open mind is having your brains fall out.
Shaunk

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top