Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQLServerCentral.com
»
Editorials
»
More Triggers
23 posts, Page 1 of 3
1
2
3
»
»»
More Triggers
Rate Topic
Display Mode
Topic Options
Author
Message
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Thursday, November 11, 2010 9:00 PM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 2:54 PM
Points: 31,410,
Visits: 13,726
Comments posted to this topic are about the item
More Triggers
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #1019679
Nakul Vachhrajani
Nakul Vachhrajani
Posted Thursday, November 11, 2010 10:14 PM
Ten Centuries
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:52 AM
Points: 1,277,
Visits: 1,608
Hello!
Happy Friday
!
I am of the opinion to have 1 trigger for business logic (per operation - Insert/Update/Delete) and 1 trigger for auditing. The prime reason being - it is easier to manage that way. Also, in the systems that I work with the amount of business logic happening in triggers is minimal, which makes this approach feasible to use.
Have a good week-end, everyone!
Thanks & Regards,
Nakul Vachhrajani.
http://beyondrelational.com/modules/2/blogs/77/nakuls-blog.aspx
Be courteous. Drive responsibly.
Follow me on
Twitter:
@nakulv_sql
Google Plus:
+Nakul
Post #1019713
a.yoganand
a.yoganand
Posted Thursday, November 11, 2010 11:43 PM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Wednesday, January 12, 2011 9:01 PM
Points: 111,
Visits: 60
Hi
I agree with Nakul. Also we can use triggers for validating complex data constraints (based on buisness logic) which cannot be done using normal constraints.
Regards
Yoganand
Post #1019732
Malcolm Currey
Malcolm Currey
Posted Friday, November 12, 2010 12:08 AM
SSC-Addicted
Group: General Forum Members
Last Login: Thursday, March 01, 2012 9:38 PM
Points: 406,
Visits: 110
I also belive in multiple triggers. I have one trigger for auditing, plus additional triggers (often more than 1) for other purposes. I find it is easier to manage the triggers this way.
Mal
Post #1019735
Carlo Romagnano
Carlo Romagnano
Posted Friday, November 12, 2010 12:47 AM
SSCommitted
Group: General Forum Members
Last Login: Friday, May 17, 2013 2:04 AM
Points: 1,968,
Visits: 1,819
I prefer multiple triggers. But, it's easier to fall in recursive triggers.
Post #1019746
jfmccabe
jfmccabe
Posted Friday, November 12, 2010 1:58 AM
Old Hand
Group: General Forum Members
Last Login: Tuesday, December 14, 2010 1:01 AM
Points: 351,
Visits: 440
I've always preferred to use views rather than tables for most of the grunt work so I end up with business logic in the view triggers and auditing in the table triggers.
We don't audit every table so that keeps it simple and we only have a few updatable views. Nobody has permissions on tables apart from developers and all the permissions are on the views.
Post #1019766
paul s-306273
paul s-306273
Posted Friday, November 12, 2010 2:43 AM
Ten Centuries
Group: General Forum Members
Last Login: Friday, May 17, 2013 4:24 AM
Points: 1,158,
Visits: 642
I think a separate trigger for auditing is definitely preferable.
Post #1019772
TravisDBA
TravisDBA
Posted Friday, November 12, 2010 5:41 AM
Ten Centuries
Group: General Forum Members
Last Login: Thursday, May 09, 2013 9:23 AM
Points: 1,288,
Visits: 2,996
paul s-306273 (11/12/2010)
I think a separate trigger for auditing is definiteley preferable.
Me too Paul. I also like to know who (or prevent) might be modifying tables, so I like DDL triggers as well.
"Technology is a weird thing. It brings you great gifts with one hand, and it stabs you in the back with the other. ...
"
Post #1019845
Steve-3_5_7_9
Steve-3_5_7_9
Posted Friday, November 12, 2010 6:14 AM
SSC Eights!
Group: General Forum Members
Last Login: Today @ 5:18 AM
Points: 810,
Visits: 1,192
As with most of the replies, I use one trigger for Auditing and one or more triggers for "other". I prefer to limit my trigger use, so I have minimal "other" triggers, but always have an "audit" trigger on DML tables.
It's easier to manage when triggers are functionally separate.
Post #1019868
schleep
schleep
Posted Friday, November 12, 2010 6:15 AM
Old Hand
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 5:38 AM
Points: 344,
Visits: 601
If possible, I prefer to avoid triggers altogether.
Having said that, on tables where business rules can be enforced using DRI and constraints, I use them for auditing.
However, my developers have been slow to move some of our apps to 100% stored procs, so some triggers are still in use for business rules in the meantime. As the apps move to stored procs, the triggers logic are phased out.
1 trigger / action.
Happy Friday.
Post #1019870
« Prev Topic
|
Next Topic »
23 posts, Page 1 of 3
1
2
3
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.