Re: What's wrong with triggers?



Aside from the portability stuff there is nothing wrong with them at all.

The big question you need to ask is - do you really want portability, is
your potential client base fixated on a specific platform, or based on my
experience as a consultant for many years, are they like the majority and
are more concerned about getting good business value out of the system and
having the necessary training to take over the support (if not provided by
the application vendor).

On the Microsoft SQL Server platform triggers offer an extremely powerful
method of doing data validation (you have before and after triggers since
version 2000), also, if you feel inclined and it sounds like you are, you
can build in some additional logic; SQL Server itself uses triggers for
merge replication.

Tony.

--
Tony Rogerson
SQL Server MVP
http://sqlserverfaq.com - free video tutorials


"scubakiz" <markk@xxxxxxxxxx> wrote in message
news:1138043308.860447.153300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>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: New to SQL server
    ... it is called triggers. ... ANYTHING THAT YOU CAN DO IN JET IS BABY TALK COMPARED TO WHAT WE CAN DO ... anything that you can do in JET that I can't do in SQL Server ... self-referencing FKs and inline constraints. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: need information for "Before Select" Trigger
    ... As i've added "Enforced Constraints" ... There are no BEFORE SELECT triggers. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Encrypting SQL objects
    ... objects, i.e. Stored procs, Views, triggers. ... engine must be able to read the source code at run to be able to compile ... And if SQL Server has access to it, ...
    (microsoft.public.sqlserver.security)
  • Re: SQL Server Express versus Access (In the World Series of Love)
    ... As far as the triggers are concerned, the first case is something to avoid ... have their usefulness, for updateability, but Jet has already updateability ... OF triggers to achieve the same, say, over view, so, advantage to Jet. ... MS SQL Server may have a horse shoe maker right out of the box, ...
    (microsoft.public.access.modulesdaovba)
  • Re: SQL 2005 & Login Triggers?
    ... Logon triggers fire after the authentication phase of logging ... PS. SQL Server 2005 Service Pack 2 is now in the "Community Technology ... - CREATE_LOGIN (Applies to CREATE LOGIN statement, sp_addlogin, ...
    (comp.databases.ms-sqlserver)

Loading