Solved

maximum row size exceeds the maximum number of bytes

Posted on 2004-03-26
5
1,132 Views
Last Modified: 2008-02-01
i built a data model in visio then generated the SQL Server database from this.  
One table "Return" has alot of columns in it - 71.  When i generated it i got this warning message

"Warning: The table 'Return' has been created but its maximum row size (14645) 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.
Warning: The table 'Return' has been created but its maximum row size (14645) 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."

what should i do?

thanks
0
Comment
Question by:cocosteel
[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
  • 2
5 Comments
 
LVL 14

Assisted Solution

by:Thandava Vallepalli
Thandava Vallepalli earned 100 total points
ID: 10686583
Hello,

Each row limit should not exceede 8060 bytes.  So the data size of the each row (i.e 71 columns data ) should not exceede 8060 bytes.  

For eg.  If you create below table

create table temptk
(
      temp1 varchar(8000),
      temp2 varchar(8000),
      temp3 varchar(8000)
)

Same warning you get. Because total size of 3 columns is 24000 bytes. It exceeds limit of 8060 bytes.

: Warning: The table 'temptk' has been created but its maximum row size (24027) 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 modified my create table script.
drop table temptk
create table temptk
(
      temp1 varchar(3000),
      temp2 varchar(3000),
      temp3 varchar(2000)
)

Now it executes without any warinings.  Because total size of the 3 columns is 8000 bytes. its is less than 8060 bytes.

All the best,
V.Thandava Krishna.
0
 
LVL 13

Expert Comment

by:danblake
ID: 10686619
Split the table into two.

Reduce the number of columns in the a single table -- so the maximum number of bytes / table row < 8060.

Otherwise you run the risk of not being able to save your data ----

Have a look here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;260418


How to calculate row-size:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_02_92k3.asp
0
 
LVL 13

Accepted Solution

by:
danblake earned 150 total points
ID: 10686635
You can probably duplicate the PK across the two tables (a vertical partioned table)....

Table1
PKFields1   PKFields2  Field3 Field4 Field5

Table2
PKFields1  PKFields2  Field6 Field7 File8


Will probably be the easiest fix mechanism if you cannot reduce the length of the columns involved.
0
 
LVL 14

Expert Comment

by:Thandava Vallepalli
ID: 10686662
Hello,

If you don't want to decrese the columns size replace varchar with text.

create table temptk
(
      temp1 text,
      temp2 text,
      temp3 text
)

You need not specify the sizes here.

All the best,
V.Thandava Krishna.
0
 

Author Comment

by:cocosteel
ID: 10687646
thanks thats fixed it.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

688 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