Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
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)

Part I: Table Size Estimation

By mcdonep,

This script will provide the first four values required for estimating the size of a database table.  It will satisfy steps one and two in MS estimation process for the amount of space required to store the data in a MS SQL Server v7.0 or v2000 table:
1    Specify the number of rows present in the table:
    Number of rows in the table = Num_Rows

2    If there are fixed-length and variable-length columns in the table definition, calculate the space that each of these groups of columns occupies within the data row. The size of a column depends on the data type and length specification. For more information, see Data Types.
    Number of columns = Num_Cols
    Sum of bytes in all fixed-length columns = Fixed_Data_Size
    Number of variable-length columns = Num_Variable_Cols
    Maximum size of all variable-length columns = Max_Var_Size

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

Values from variable length flat files

using values from variable length flat file in multiple rows


Get longest length of data in a column

Get longest length of data in a column


Concatenate variable length rows

Trying to get rows with same number of columns


variable column count txt files to sql server table

Importing variable number of columns into a single sql table.


Generate script to change column length of string datatypes in a DB

This script can be used to generate alter column length of any string data type column(s) in a datab...


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones