SQL Server Edit Rows grid: string or binary data would be truncated

yk9xbfzb  于 2023-06-21  发布在  其他
关注(0)|答案(3)|浏览(196)

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?

zqdjd7g9

zqdjd7g91#

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.

9gm1akwq

9gm1akwq2#

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;
ncgqoxb0

ncgqoxb03#

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.

相关问题