Size of Table

  • How to identify and restrict size of a table in db?

  • Are you talking about disk size or row count?  sp_spaceused tablename   will tell you the size of a table.  As far as restricting the disk size, the only thing I can think of is to put it in it's own filegroup and limit the size of the filegroup.  But it's not a very exact solution.  Plus, once you hit the limit, all additions to the table will fail.

  • You could put a trigger trigger on the table that counts the rows in the table... could be either an AFTER trigger that deletes what's been inserted once it hits a limit or an INSTEAD OF trigger that prevents insertion altogether.

    --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 3 posts - 1 through 2 (of 2 total)

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