What's wrong with triggers?
- From: "scubakiz" <markk@xxxxxxxxxx>
- Date: 23 Jan 2006 11:08:28 -0800
I recently saw a comment by CELKO regarding SQL Triggers that advised
to "...avoid triggers whenever possible.". This is the first time I'd
ever heard anything bad said about triggers and was wondering if
someone could give me some insight behind that advise?
I've used triggers for years without any problems. I think they're one
of the best features of "real" SQL servers and often one of the raional
to migrate from toys like MS Access (yes, there are a lot more reasons,
but this is one of the easier ones to explain to a "business minded"
customer).
Granted, the triggers I write don't have any real functionality in
them, they simply call stored procedures to do the actual work. This
allows the process to be manually re-executed if needed. But I'd like
to know what other mechanisim exists for creating automated systems
that have access to the INSERTED and DELETED tables which drive the
rest of my process?
I recently created a system that takes data from peices of hardware
(via a PC app) and writes it to a database. The data is automatically
processed using triggers and stored procs and replicated to a central
SQL server, where more processing occurs, again with triggers and
stored procs. The processed data is available to the customer on a
website within 15-30 seconds after the event. The delay is due to
replication.
Without triggers, I'd have to write an app to poll the database every
so often to look for new data. I'd have to have another app at the
central server to do the same. All these apps would do is call stored
procs. And besides, the data would have to be marked to indicate that
it was new, something not needed in triggers due to the existance of
the INSERTED table.
System Used: MS SQL Server 2000 Desktop Edition at 3 remote data
collection sites and MS SQL 2000 Standard Edition for the central
server.
Thanks
.
- Follow-Ups:
- Re: What's wrong with triggers?
- From: Tony Rogerson
- Re: What's wrong with triggers?
- From: --CELKO--
- Re: What's wrong with triggers?
- From: Bill Karwin
- Re: What's wrong with triggers?
- Prev by Date: Good list/forum for PostgreSQL?
- Next by Date: Re: What's wrong with triggers?
- Previous by thread: Good list/forum for PostgreSQL?
- Next by thread: Re: What's wrong with triggers?
- Index(es):
Relevant Pages
|
Loading