?
Solved

How i calculate the size of a DataRow

Posted on 2003-02-20
2
Medium Priority
?
523 Views
Last Modified: 2011-10-03
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
Comment
Question by:ch_reinke
[X]
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
2 Comments
 
LVL 3

Accepted Solution

by:
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
0
 

Expert Comment

by:CleanupPing
ID: 9276508
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

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