stored procedure to estimate the table size

  • i have to preestimate the given table size based on the number of records.

    example: if i populate 100 records how much size the table will increase(data+index_size).i have to preestimate the size value and i have to warn the user that DB size will increase to this much.

    Can someone help on this.

    thanks in advance.

  • Build the table with 1 "typical" row in it and all of the necessary indexes. Run DBCC UPDATE USAGE and then run sp_SpaceUsed on the table. Save the results somewhere.

    Insert the table into itself until you have 101 rows. Repeat the BCC UPDATE USAGE and sp_SpaceUsed steps. Compare the results from the 1 row run and you will easily have your answer.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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