Avatar of NYGiantsFan
NYGiantsFan
Flag for United States of America asked on

String or binary data would be truncated.- sql 2000

Hi,

I have field that has data in it.  When I attempt to update either using sql languageor by the enterprise manager I get the error "String or binary data would be truncated.".

I have tried to delete all the data in the field without success.  I cannot modify this field in any way.  I have also increased the column size without success.  I can do nothing with this.  

Any ideas?
String or binary data would be truncated.

Open in new window

Microsoft SQL Server

Avatar of undefined
Last Comment
NYGiantsFan

8/22/2022 - Mon
Nathan Riley

It's because the data would be shortened by the update b/c the field is limited to the amount of characters.  What type of field is it?
dqmq

What is the column definition and what is the update statement?
NYGiantsFan

ASKER
The column is a char... originally 1000 that I increased to 2000.  That didn't work.

The sql statement is

UPDATE    tbl_form_requestv2
SET              additionalcomments=

'American                      FF# E6599C0
National Car Rental Emerald Number:_3333333
request Mövenpick Hotel Nürnberg Airport for the night of the 3 Apr. '



WHERE     (travelrequestid = 15277)

__________________________________

No matter what I do to the set additionalcoments = statement, it fails.

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Nathan Riley

Can I see your table structure
NYGiantsFan

ASKER
It is a really big table....
top.jpg
part2.jpg
Nathan Riley

I show your update statement with the column "additionalcomments" but I don't see that field in the table, I do see "additionalremarks", is that a typo?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
dqmq

I think you are exceeding the limit in bytes per row (around 8000) not the limit in bytes per column.  Suggest converting most of those large char columns to VARCHARS to conserve space.  If that is not enough, then consider vertical partition to another table.

NYGiantsFan

ASKER
Can I change a char to a nvar while the server is live? As you can see, this isn't exceeding 8000 char.



My code

UPDATE    tbl_form_travelrequestv2
SET              additionalremarks = 'American                      FF# E6599C0
National Car Rental Emerald Number:_663999652
request Mövenpick Hotel Nürnberg Airport for the night of the 31st Mar.                                                                                                                                                                                                                '
WHERE     (travelrequestid = 15277)
NYGiantsFan

ASKER
I tried to change the fields to nvarchar and am getting this error message:


'tbl_form_travelrequestv2' table
- Unable to modify table.  
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot create a row of size 10677 which is greater than the allowable maximum of 8060.
[Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated.



Your help has saved me hundreds of hours of internet surfing.
fblack61
NYGiantsFan

ASKER
How did the row size get to be 10677 when none of those char fields are that long!?!
dqmq

nVarchar takes 2 bytes per character.  try Varchar.  

ASKER CERTIFIED SOLUTION
dqmq

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
NYGiantsFan

ASKER
Thank you for the insight.  Yes, I know the table structure is not great.  Will attempt to restructure.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.