October 1, 2007 at 7:44 am
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.
October 1, 2007 at 8:16 am
take a look at this thread:
http://www.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
October 1, 2007 at 8:29 am
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
October 1, 2007 at 11:38 pm
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