SQL Server Performance

Before delete trigger

Discussion in 'General DBA Questions' started by homnath_sharma, Dec 6, 2006.

  1. homnath_sharma New Member


    Please help me on this.....

    1. I need to do "before delete" trigger implementation. But which is not supported by MSSQL server.

    Please help me how to achieve this....

    Thanks n Regds.
  2. chetanjain04 Member


    I do not understand what do u mean by BEFORE DELETE trigger. The FOR DELETE trigger in SQL Server is the before delete trigger itself. Refer BOL for the same.


  3. madhuottapalam New Member


    You can check with INSTEAD OF DELETE Triggers

  4. homnath_sharma New Member

    I can create INSTEAD OF TRIGGER,
    because after performing certain activities at the time of this trigger, records will not be deleted as like in "BEFORE DELETE".
  5. madhuottapalam New Member

    Your requirement is not clear. p'se post a scenario what u r actually looking for.

  6. Adriaan New Member

    If you have an INSTEAD OF trigger, and you still need to get the action done on the underlying table, then you have to repeat the action in the trigger.

    Add a statement like this to your INSTEAD OF DELETE trigger, which joins the underlying table to the "deleted" conceptual table:

    WHERE <key> IN (SELECT <key> FROM deleted)

    Note that you cannot have an INSTEAD OF trigger if the table is also the parent table in a foreign key relationship with cascading deletions.

Share This Page