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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A script to calculate the size of a database?

Status
Not open for further replies.

mjp483

Programmer
Apr 27, 2004
42
US
Does anyone have a script to calculate the size of a single table?

I want to calculate the table size before and after I transport it to another db.

Mike
 
I meant to title this "A script to calculate the size of a table
 
there is a stored procedure called sp_spaceused that can be used to calculate the size of the database,
like execute sp_spaceused

or to calculate the size of a single table,
like execute sp_spaceused 'table_name'

that should do the trick.

cfw2
 
Thanks that works great.

One thing I notice, when I drop and recreate my table, insert ALL data from the source table, and then compare using sp_spaceused 'TableName' I see a difference in the data size returned from sp_spaceused.

The number of rows is the same....Is there a reason the data size would be different between source and destination immediately after I run my transport script?

Ex:

Source
data = 35016 KB
Destination
data = 35240 KB





 
Yes, copying is dynamic process - a bit more complex than equivalent to physical moving object from location A to B.

------
heisenbug: A bug that disappears or alters its behavior when one attempts to probe or isolate it
schroedinbug: A bug that doesn't appear until someone reads source code and realizes it never should have worked, at which point the program promptly stops working for everybody until fixed.

[ba
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top