Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Simple Trigger Question

Author  Topic 

JacobPressures
Posting Yak Master

112 Posts

Posted - 2005-08-22 : 11:25:25
Should i create only one trigger for each table and put all the table functionality in that one trigger?

For example: tr_tblCategory, tr_tblQuestion, tr_tblAnswer

Or should i create a different trigger for each different function on that table?

For example: trReviseDate, trDoThis, trDoThat, trVerifyThis

Is there a better practice in this area?

What do you typically do?

Thanks!

X002548
Not Just a Number

15586 Posts

Posted - 2005-08-22 : 15:07:30
Ya gotta be a little more concrete with the examples...



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-08-22 : 15:47:11
I do it all in one trigger [for each table]. I'm then sure I haven't overlooked some other forgotten trigger that might going to be calling in on the act!

Kristen
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-22 : 15:50:24
Why isn't this stuff built into the stored procedure?

Tara
Go to Top of Page

JacobPressures
Posting Yak Master

112 Posts

Posted - 2005-08-22 : 16:16:37
Thanks Kristen!

quote:
Originally posted by tduggan

Why isn't this stuff built into the stored procedure?

Tara



I'm a newbie, and the books i've read said that everything no handled by a contraint should be put into a Trigger the so called next best thing.

I'm just using the trigger to enforce business rules.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-22 : 16:19:21
quote:
Originally posted by JacobPressures

Thanks Kristen!

quote:
Originally posted by tduggan

Why isn't this stuff built into the stored procedure?

Tara



I'm a newbie, and the books i've read said that everything no handled by a contraint should be put into a Trigger the so called next best thing.

I'm just using the trigger to enforce business rules.




Oh my! What book is this?

Tara
Go to Top of Page
   

- Advertisement -