Click here to monitor SSC
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)

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: 488 | Views in the last 30 days: 1
 
Related Articles
FORUM

Values from variable length flat files

using values from variable length flat file in multiple rows

FORUM

Get longest length of data in a column

Get longest length of data in a column

FORUM

Concatenate variable length rows

Trying to get rows with same number of columns

FORUM

variable column count txt files to sql server table

Importing variable number of columns into a single sql table.

SCRIPT

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...

 
Contribute