Link to home
Start Free TrialLog in
Avatar of soni1978
soni1978

asked on

Insert error...String greater than 8060.


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.
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

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?
Avatar of soni1978
soni1978

ASKER


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.
Instead of using such big fields, use a Memo field (type TEXT in SQL)
ASKER CERTIFIED SOLUTION
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial