Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Is trigger a bad solution Expand / Collapse
Author
Message
Posted Monday, March 11, 2013 4:05 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 2:17 AM
Points: 203, Visits: 499
Dear,
I fire triggers on different events. But some of my clients insist on not using trigger. Because they claim that using triggers are the worst solution. It may disable any time. But I don't get any clue.

Please help me.

Regards,
Akbar
Post #1429133
Posted Monday, March 11, 2013 4:29 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 3:46 PM
Points: 42,462, Visits: 35,525
Only time a trigger will be disabled is if someone goes in and disables it.

Triggers shouldn't be the first choice, if a problem can be solved without a trigger then it should be solved without a trigger. Check constraints, foreign keys, etc. If there's no other way than a trigger, then use one and make sure it's written efficiently and correctly to handle multiple rows.



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1429145
Posted Monday, March 11, 2013 1:09 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 2:17 AM
Points: 203, Visits: 499
Thank you, it helps me. I got the point.
Post #1429451
Posted Tuesday, March 12, 2013 8:01 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Friday, July 25, 2014 3:19 AM
Points: 4,320, Visits: 6,113
shohelr2003 (3/11/2013)
Dear,
I fire triggers on different events. But some of my clients insist on not using trigger. Because they claim that using triggers are the worst solution. It may disable any time. But I don't get any clue.

Please help me.

Regards,
Akbar


Use the right tool for the job, and there are definitely situations where a trigger is just that.

As Gail says, be CERTAIN to code the triggers to handle multiple rows in a single DML statement against the base table. THAT IS A CRITICAL FLAW!!!!! I know of more than one company that went out of business because they failed to do that and had bad data processing.


Best,

Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru at GMail
Post #1429830
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse