Assuming I have the following table:
Create Table [dbo].[Test_IP] ( [IP] varchar(40), [IPType] varchar(6) )
There are more triggers on this table, but all of them are AFTER triggers, and it is large DB with many tables, views and stored procs, and it been used from several processes.
I added a log table and triggers like this
Create Table [dbo].[Log_Test_IP] ( [Action] varchar(10), [IP] varchar(40), [IPType] varchar(6) ) GO Create Trigger MYTR_Log_Test_IP_INS On [dbo].[Test_IP] After insert AS BEGIN insert into [dbo].[Log_Test_IP]([Action],[IP],[IPType]) select 'Insert', [IP], [IPType] from inserted END GO Create Trigger MYTR_Log_Test_IP_DEL On [dbo].[Test_IP] After delete AS BEGIN insert into [dbo].[Log_Test_IP]([Action],[IP],[IPType]) select 'Delete', [IP], [IPType] from deleted END GO
Now I'm getting to the interesting part: when I directly insert to the
Test_IP table I can see the Insert trigger is working, but when it works regulary from an application or service (which I have no idea what it does) I don't see any Insert records in the log table, I can only see the 'Delete' records even though it was enpty in the start.
My conclusion is that there is some way to bypass the triggers, there are many triggers and stored procedures in the DB and I have no idea where to look.
So, my question is how can you bypass the trigger?