Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 873
MANISHDAN LANGA Avatar asked Mar 01 '12 12:03

MANISHDAN LANGA


1 Answers

Step 1 Disable Trigger

DISABLE TRIGGER Person.uAddress ON Person.Address;

http://msdn.microsoft.com/en-us/library/ms189748.aspx

Step 2 Do stuff

UPDATE Person.Address SET HouseNumber = REPLACE(HouseNumber, ' ', '');

Step 3 Enable Trigger

ENABLE Trigger Person.uAddress ON Person.Address;

http://msdn.microsoft.com/en-us/library/ms182706.aspx

-- Must say, use with care!

like image 50
Ralf de Kleine Avatar answered Nov 06 '22 06:11

Ralf de Kleine