Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm created trigger for insert. but some condition and some code have a little problem so i deleted this condition and code. but this condition and code is still work.
example;
SQL
CREATE TRIGGER [dbo].[TRG_INSERT_table] 
   ON  [dbo].[tb_table] 
   FOR INSERT
AS 
BEGIN
 IF --Condition 1
   BEGIN
     --Some Code doing here
     --This code is ok
   END
 ELSE
  BEGIN
   IF --Condition 2
     BEGIN
        --Some Code doing here
        --This code is ok
     END
---#####This code block was deleted####----
---but still work in my database----------
   ELSE 
     BEGIN
     IF --Condition 3 
       BEGIN
        --Some Code doing here
        --This code have some problem
       END
     END
-----############---------------------
  END
END
Posted

1 solution

Looks like you are missing an END statement for the condition-2 if...

Perhaps because you have an error in your SQL procedure its using an older version? I'm not sure if SQL works like that or not...
 
Share this answer
 
Comments
hein thu 21-May-13 0:16am    
thank Ron Beyer. now I'm check my conditions. condition 2 code is working like this condition 3.so I think condition 3 had problem. but a little problem have condition 2.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900