• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 543
  • Last Modified:

How i calculate the size of a DataRow

Hi,
i will change the datatyp of an column to varchar, size 8000. I get this warning:
"Warning: The table 'TemplateItems' has been created but its maximum row size (8063) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes."

Now i want to calculate the size of this Table. Tablestructure:

PK      Name          DataTyp   Length  Nullable
--------------------------------------------
0     system             int     4     1
0     systime             bigint     8     1
1     id             bigint     8     0
0     idTemplate     bigint     8     0
0     idColumn     bigint     8     0
0     RowNo             int     4     0
0     Value_             varchar     8000     1

I had found this page from MS to calculate
the size of one row:
http://msdn.microsoft.com/library/en-us/createdb/cm_8_des_02_92k3.asp

I had calculate the size:

Num_Cols = 7
Fixed_Data_Size = 40
Num_Variable_Cols = 1
Max_Var_Size = 8000
Null_Bitmap = 2 + ((Num_Cols + 7)/8) = 2
Variable_Data_Size = 2 + (Num_Variable_Cols x 2) + Max_Var_Size = 8004
Row_Size = Fixed_Data_Size + Variable_Data_Size + Null_Bitmap + 4 = 8050

I get a different size as the size in the warning.
8050 <-> 8063

What i do wrong?





0
ch_reinke
Asked:
ch_reinke
1 Solution
 
hakyemezCommented:
Because ROWSIZE max 8K

Look at the System table your table structure...
SELECT * FROM syscolumns
WHERE id=OBJECT_ID('<your_table_name>') ORDER BY colid
0
 
CleanupPingCommented:
ch_reinke:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now