0

I am trying to change a "Y" to an "N" in a column. I have already changed that value in several rows, but one specific row is throwing the error.

Here is the error:

The data in row 170 was not committed.
Error Source: .Net SqlClient Data Provider.
Error Statement: String or binary data would be truncated.
The statement has been terminated.

What is it about this row that is causing this error?

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
Tom
  • 5
  • 2
  • Can you post your sql and your table schema? – MikeS Jan 24 '17 at 18:25
  • 1
    Check for triggers, but yeah, tough to help you solve this without definition of the column, the values in the row that's failing, and the code (or values) that cause the error. Hint: the error might not be coming from the column you're changing. – Aaron Bertrand Jan 24 '17 at 18:32

3 Answers3

1

Changing a 'Y' to an 'N' shouldn't cause a problem.

Check the Table for a Trigger that might be sending data to another Table where the Truncate is occurring on another Field.

pacreely
  • 1,881
  • 2
  • 10
  • 16
0

One solution would be to use a query to update the value instead of (I'm guessing) the edit rows designer in SSMS.

e.g. If your table was tbl, the column was col, and your primary key was id and that value was 170.

update tbl set col='N' where id = 170;
SqlZim
  • 37,248
  • 6
  • 41
  • 59
0

Had the same error when inserting text into a TEXT column.

Changed it to VARCHAR(MAX) and the problem was gone.

Using an insert command to insert the exactly same text worked in both cases.. at least for me.

Roli
  • 1
  • 5