|
I am using an insert trigger to store or update the values of second table while inserted in the first table by performing some calculations. For update operation also i need to update some columns in the second table. But while updating i am getting the following error. The error message is as follows: "The row value(s) updated of deleted either do not make the row unique or they alter multiple rows(5 rows)". Please provide a solution for this.
(comments are locked)
|
|
Make sure you are using the correct WHERE clause on the second table, that is, the WHERE clause has to contain the columns for the primary key/unique index. Personally I try to avoid triggers because of the performance impact, I try to build this kind of logic in stored procedures and prevent direct access to the tables. All data access is done through stored procedures. +1 - agreed, avoid triggers for this because of performance.
Feb 15 '10 at 09:00 AM
Fatherjack ♦♦
+1 Stored procedures should be used but rarely possible unless you have had a hand in building the database from scratch!
Feb 15 '10 at 11:56 AM
Ian Roke
Triggers do have their uses, primarily for guaranteed logging or certain types of data integrity that cannot be done with simple foreign-keys. Still, I agree they should be used only with caution and that the problem here is probably in the where clause.
Feb 15 '10 at 01:06 PM
TimothyAWiseman
(comments are locked)
|
Mr.Apeman, I am using sql server 2005,and i am getting this error message after updating only in the database itself and not in any application.
Feb 16 '10 at 12:34 AM
Damus
(comments are locked)
|

