10774 - Avoid, if possible, creating triggers

Hi experts,

can you give me an example in TSQL for this:
Avoid, if possible, creating triggers, for this, you can use procedures
stored to incorporate logic trigger.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Again: Without context, this is not generally true. Triggers maybe necessary for your model or not. Hard to tell without further details.
enrique_aeoAuthor Commented:
It is advice for the optimization of queries
ste5anSenior DeveloperCommented:
Triggers have nothing to do with performance. Triggers are necessary for the integrity of your data model.
PortletPaulEE Topic AdvisorCommented:
Triggers can (and do) impact the performance of inserts & updates; but that does not make Triggers inherently bad.

Indexes can (and do) impact the performance of inserts & updates; but that does not make Indexes inherently bad.

As ste5an rightly points out Triggers are used for data integrity & quality (e.g. a cascading update).

This advice "Avoid, if possible, creating triggers" needs to be assessed by the "if possible" phrase.
Why would you create triggers for not good reason?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.