Search code examples
sql-serversql-server-2008sql-server-2005triggers

How to bypass trigger on SQL Server 2008


I want to bypass a trigger on some cases, can any one help me on it ?

I have a try with this link but not able find out the solution.

Thanks in advance


Solution

  • you cant avoid a trigger from being run. What you can do is add conditions in it, for example:

    CREATE TRIGGER trigger_name
       ON table
       AFTER INSERT 
    AS
    begin
       IF (your condition) begin
         --code
       END
    end
    

    just be careful if you have a INSTEAD OF trigger. If you don't code the insert, nothing will be inserted on the table.