Thursday 14 February 2013

SQL Update Trigger Error

I was creating a trigger in SQL Server today and encountered an odd error.  The trigger was in a purchase order table and I wanted it to update a value in each row of the purchase order line table for the po when a vendor date was changed.

The error I was getting was:

No row was updated.
The data in row 1 was not committed.
Error Source: Microsoft.SqlServer.Management.DataTools.
Error Message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows(2 rows).

Much Google searching later...

To fix, add the following line above your UPDATE statment

SET NOCOUNT ON

That fixed the problem for me.

No comments:

Post a Comment