How i calculate the size of a DataRow

Posted on 2003-02-20
Medium Priority
Last Modified: 2011-10-03
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:

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?

Question by:ch_reinke
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

hakyemez earned 300 total points
ID: 8021098
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

Expert Comment

ID: 9276508
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 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question