SQL Server Performance

Stored Procedure to pre estimate the table size based on the number of records

Discussion in 'SQL Server 2008 Questions [Archive Only - Closed]' started by vinayak, Nov 10, 2009.

  1. vinayak New Member

    Hi,
    I need to caliculate the DB size based on the no of records before populating the table with the data.
    Is there any stored procedure which will estimate the table size based on the no of records.
    I need this for SQL 2005 and 2008.
    Thanks in advance.
  2. FrankKalis Moderator

    So, this http://sql-server-performance.com/Community/forums/t/20543.aspx answers your question then?
  3. vinayak New Member

    Hi,
    Thanks for the reply.
    i tried the same procedure but its not giving the accurate size values for SQL 2005 and SQL 2008.
    Can you please point me to a solution to get the accurate size of the table.
    Thanks in advance.
  4. Rocky1007 New Member

    SP_SpaceUsed displays how much data a table is using.It shows results for both the data, as well as the indexes (never forget the index space).You can run it as simply as:exec SP_SPACEUSED 'TableTest1'Now you can get a unit-size per row. For example, if the table has 3000KB for data, and 1500KB for indexes, and you inserted a 100K rows, then the average size per row is: (3000KB + 1500KB) / 100,000. Then, multiple that by however many rows you expect.

Share This Page