0
votes

I have table1 and table2

In table1 I update a row and it starts an after update trigger that updates rows in table2, in table2 is after update trigger that calculates sum from table1.

The problem is that it calculates with the old value from table1 not the updated new one.

Is there any solution to see the updated value in talble1 to be able to calculate with it in table2 trigger?

i found a sloution in trigger on table1 the code was like update rows in table2 and do other stuff
now it is do other stuf and as last step update rows in table2 , now it sees the updated row with new value...

1
Share us the sample code you have tried. Have you tried with Inserted table. - StackUser

1 Answers

0
votes

You can try:

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

or even the NOLOCK query hint, but be warned. there can be serious consequences on both these options. You would need to be sure that there is nothing else that could be updating the same data at the same time for this to be an option.

See http://sqlblog.com/blogs/tamarick_hill/archive/2013/05/06/pros-cons-of-using-read-uncommitted-and-nolock.aspx for more detail

Hope that helps