i make a trigger fire when an update happened in a table which contain self join relation as i want to update the current balance of the parent account and so on when an update happened in the last child this is the code that i wright
any body can help thanks
As a side note, take a moment to make your trigger multi-row update safe.
As it stands, if someone executes this:
you will work out a value for @value from one record and apply it to both (and their parents once you get nested triggers enabled)
As Rob already answered here, the feature you want is controlled by a database option RECURSIVE_TRIGGERS.
Remember, that there is more to take in mind when using a recursive/nested triggers.
See BOL http://msdn.microsoft.com/en-us/library/ms190739%28SQL.90%29.aspxn on this topic.
You must think about the limits of the recursion etc. so the recursion needs to be designed quite well to not cause problems.
Also as Mister Magoo wrote here, you have to update your trigger code to be multi-row safe to be able to handle multi-row updates to the table as he mention.
answered Mar 16, 2010 at 04:09 AM
Allowing triggers to call other triggers is a database option. Have a look at th Properties of your database to see if it's turned on.
answered Mar 15, 2010 at 09:33 PM