Table size based on the structure of the table (very urgent)

  • I have many tables in my database, but there is no records in all these table. i want to find the size of the table based on the table structure like

    col1 varchar(255),

    col2 varchar(50),

    col3 int,

    col4 decimal(9,4),

    col5 decimal(5,2),

    255+ 50+ int value + decimal val(9,4) + decimal val (5,2). can anyone help me find the size of the table based on the structure in the db for each table.

    Thanks.

  • take a look at this thread:

    http://qa.sqlservercentral.com/Forums/Topic385732-9-1.aspx

    it has solutions for the defined size you are looking for, as well as MarcusB's solution for the largest row in the table, and finally the largest size for the rows, so if you wanted to shrink columns that were defined as varchar(255), but you only used 18 characters.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • The size of the decimals will be in both cases 5 bytes (because the precision is between 1 and 9), so the total is 25. I.e. your row will take at least 25 bytes, plus the variable length data. The maximum amount it will use 305+25=330 bytes. Lovell's link will help you to get more detailed information though.

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Really usefull and helpful. thanks for the prompt response

Viewing 4 posts - 1 through 3 (of 3 total)

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