Solved

Insert error...String greater than 8060.

Posted on 2002-03-05
4
432 Views
Last Modified: 2010-05-18

Is there a way out to the following error:

Server: Msg 511, Level 16, State 1, Line 1
Cannot create a row of size 8247 which is greater than the allowable maximum of 8060.
The statement has been terminated.

I get the above error when i try to insert sql with a large string. Is there any other way out or i have to break my query into smaller parts?

Please advise.

Thanks.
0
Comment
Question by:soni1978
  • 2
4 Comments
 
LVL 32

Expert Comment

by:bhess1
ID: 6841942
The maximum size of a row in SQL Server is 8060 bytes.  If you have more data than that to store in one record, you need to use the text, ntext, or image data types to store the information.

This can be a problem if you define a record with a number of smaller fields that total more than 8060 bytes, e.g. 100 varchar(100) fields.  You can create a table like this (in this case, theoretically it could hold 10000 bytes).  However, if you place more than 8060 bytes in the record, the data will be truncated.

What is your data layout for the table?  Could you use a text field, or will you need to use more than one record?
0
 

Author Comment

by:soni1978
ID: 6844110

The table has 40 fields. There are 2 fields defined as varchar(5000) and 1 field defined as varchar(8000). It is not possible to change the table design as it is used by other system (but can change sizes if required)

The data comes from outside world in XML files. I have to interpret and insert in the database.
0
 
LVL 4

Expert Comment

by:vindevogel
ID: 6844495
Instead of using such big fields, use a Memo field (type TEXT in SQL)
0
 
LVL 32

Accepted Solution

by:
bhess1 earned 100 total points
ID: 6845394
Agree with vindevogel.  

As I noted, the actual data in each row cannot exceed 8060 bytes, no matter what data types you use, unless you use the Text, nText, or Image data types.  If your total data length for all of the fields is > 8060, the insert will fail.

Now, if you change the Varchar(5000) and varchar(8000) fields to type Text, then the insert should work.  You may need to do an Insert and then an Update, since the SQL statement also has a maximum length (insert the other data, then update the long fields with the information).
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

757 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

21 Experts available now in Live!

Get 1:1 Help Now