Re: How to work with triggers and relations

From: Tom Moreau (tom@dont.spam.me.cips.ca)
Date: 11/07/02


From: "Tom Moreau" <tom@dont.spam.me.cips.ca>
Date: Thu, 7 Nov 2002 15:38:58 -0500

Constraints get checked before triggers can fire. In SQL 7.0, there were no cascaded deletes via FK constraints, so the delete would fail and the trigger would not fire. In SQL 2K, you can change the FK constraint to use ON DELETE CASCADE, thus precluding the need for a trigger for this task. For more info on triggers and DRI, check out:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sql_refintegrity.asp

-- 
Tom
---------------------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCT
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
  "Ing. Juan Manuel Alegría B." <jmanuel@mbge.com.mx> wrote in message news:eB6pAjphCHA.1688@tkmsftngp08...
  Hi group.  I have a question.  I had been working with SQL Server 2000 and I
  had my relations with cascade update and delete. But I had to work with SQL
  Server 7.0 and I discovered that SQL 7.0 doesn't manage
  the update and delete cascade, so I had to make some triggers to solve that
  problem.  But When I tried to work with the relations and triggers I had a
  problem.   I think the problem is that the triggers can't execute itself
  because exists a relation.  Maybe you know if exists any function or
  configuration to the trigger doesn't take care of the relation. .
  Thanks so much.
  --------------------------------
  Atte.
  Ing. Juan Manuel Alegría Bobadilla
  jmanuel@mbge.com.mx
  Guadalajara, Jalisco, México


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: 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)

Quantcast