trigger vs referential integrity

  • Hi Everyone,

    I have two tables parent, child.

    I have a foreingn key constraint in child table with cascading options enabled (update and delete).

    More over, i have a trigger in child table, in that i want to eliminate the trigger to be fired while the time of it is being executed through referential cascadings.

    Is that any way to find out, whether the trigger is fired by the user (a record deleted only in child table) or by the referential integrity ( a record deleted in parent table).

    Thanks

  • You could trap the execution of the trigger by putting in code that would insert a record into a log table, it's similar to the technique for producing audits. The record would commonly consist of timestamp info, user info, the name of the table or trigger, the action performed, and any key information that you wanted to track.

    Unfortunately you can't track a cascade this way.

    Another option would be to implement all your record operations (insert, delete, update) into stored procs and have the procs update an activity log.

    -----
    [font="Arial"]Knowledge is of two kinds. We know a subject ourselves or we know where we can find information upon it. --Samuel Johnson[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply