Solved

maximum row size exceeds the maximum number of bytes

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
find SQL job run average duration 24 54
SQL Consolidate rows 3 26
Convert VBA UDF to SQl SERVER UDF 4 48
How can I retrieve the column names from a T-SQL table? 2 14
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

762 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