Hi I am having a problem when trying to update a table using an IN clause, I have a big list of clients that should be updated 4500+.
Update table
set columnA = 'value'
where ID in ( biglistofids ) //biglistofids > 4500 ids
I am getting this error
“String or binary data would be truncated.”
I tried the same script with fewer ids lets say (2000) and it worked fine.
I have also tried using a temporal table but I got same error.
SELECT Id INTO tmpTable FROM dbo.table WHERE id IN (biglistofids) //create temporal table succesfullyUpdate table set columnA = 'value' FROM table INNER JOIN tmpTable ON table.ID = tmpTable.ID
Is there any way to handle this, without repeating code for each 2000 records?
Thanks in advance
The
"String or binary data would be truncated."has nothing to do with theINclause.It means in this line:
you are setting
columnAto something that is too long to be held incolumnA.Maybe certain
ids have corresponding data that is too long, and these are not among the first 2000 you have tried.