Estimate the table size for SQL 2005 and 2008

  • Hi All,

    i have to estimate the table size based on the no of rows.

    If user enters table name and no of rows, i need to tell teh size occupied by the rows.

    Can somebody help on this.

  • Create procedure Estimate(

    @Rows int

    ,@TableName varchar(32)



    select sum(length)* @Rows AS SizeInBytes

    from sys.syscolumns

    where id = object_id(@TableName)

    But this code will give you the maximum size your row will occupy because it sums the size defined of all the variable data types (like varchar).

    -Vikas Bindra

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply