What's wrong with triggers?



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

.



Relevant Pages

  • Re: User and Login auditing
    ... I am running SQL 7. ... You could put triggers on your trace table. ... How to Trace in SQL Server by Using Extended Stored ...
    (microsoft.public.sqlserver.security)
  • Re: Whats wrong with triggers?
    ... On the Microsoft SQL Server platform triggers offer an extremely powerful ... > (via a PC app) and writes it to a database. ... > processed using triggers and stored procs and replicated to a central ...
    (comp.databases)
  • Re: Triggers in Firebird and C63EE
    ... i made an example app that use some firebird tables, ... handle autoinc sql triggers. ... How to handle these triggers? ... Use combination of App triggers and procedures which return ID. ...
    (comp.lang.clarion)
  • Re: Hi all
    ... Triggers can easily get unmanageable and are ... tcross rapttech dot com dot au ... getting some orders for my project which i have developed using SQL ... Server.But some clients need Oracle version. ...
    (comp.databases.oracle.server)
  • Re: Need to create my own environment variable in Informix
    ... If you mean different customers then... ... Use m4 or cpp to preprocess the sql that creates the triggers. ... Subsequent code releases do not overwrite the active directory or the ...
    (comp.databases.informix)

Loading