Solved

# How i calculate the size of a DataRow

Posted on 2003-02-20
Medium Priority
523 Views
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

the size of one row:
http://msdn.microsoft.com/library/en-us/createdb/cm_8_des_02_92k3.asp

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
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

LVL 3

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
0

Expert Comment

ID: 9276508
ch_reinke:
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

## Featured Post

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
Course of the Month15 days, 15 hours left to enroll