Re: How to distinguish operation type in trigger?



Seribus Dragon (Seribus.news@xxxxxxxxxxx) writes:
Why not just break up the action into three triggers? if there is
common code use a stored procedure got that part.

That can be problematic, if you need to refer to the inserted/deleted
tables, which you often do in triggers.

Most of my triggers are for INSERT and UPDATE, but I have a couple
that are for all three actions.

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: need information for "Before Select" Trigger
    ... As i've added "Enforced Constraints" ... There are no BEFORE SELECT triggers. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: UPDATE query gives Incorrect Syntax error
    ... Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books ... ... No - no triggers on the table. ... Is it possible that a previous query has somehow become trapped and is ...
    (comp.databases.ms-sqlserver)
  • Re: Table Changes
    ... There are a couple of third-party tools out there. ... triggers, others by reading the transaction log. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: need information for "Before Select" Trigger
    ... i've used lots of .net functionalities and now i cant make any changes ... There are no BEFORE SELECT triggers. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: 2005: cannot to connect from .NET
    ... SQL Server permits you to install several instances on the same machine. ... When you refer to a default instance, you refer only to the machine name, ... When you refer to a named instance, you must also include the instance ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)

Loading