Solved

maximum row size exceeds the maximum number of bytes

Posted on 2004-03-26
5
1,109 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
  • 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Server 2012 HA Cluster, Utility Controller No Data 11 59
c# code 19 61
Report Builder 9 31
Stored procedure 23 25
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now