delete trigger

  • Hello:

    Is it possible to prevent all deletes to a table except when it is done via a trigger?

    Thanks in advance,

    Billy

  • You want to prevent deletes to the table A axcept if it is done from a trigger on table B.

    Create a DELETE trigger for table A with this code only:

    IF NOT( <condition> ) ROLLACK TRANSACTION

    RETURN

    The <condition> should check if delete is going from another trigger. Well, you would have t set a flag in your dataabse and read it here.

    There is a config. function @@NESTLEVEL that checks nesting level of stored procedure calls. I am not sure how it works in case of triggers. Try it. Let me know.

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

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