Re: understanding triggers and "inserted" and "deleted"

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 10/04/04


Date: Mon, 4 Oct 2004 14:11:37 -0400


"Maury Markowitz" <MauryMarkowitz@discussions.microsoft.com> wrote in
message news:FCA225B5-FE54-4259-8EB9-9BF0CDD7E6F6@microsoft.com...
>
> Let's say my COMMIT have two inserts and two updates. I have separate
> triggers for INSERT and UPDATE, and thus I can imaging four different
> scenarios:
>
> 1) triggers are called one after the other, with the inserted and deleted
> being different each time (ie, two rows, then another two rows)

    You were closest with this guess... You'll actually end up firing the
trigger(s) 4 times. Once per insert (2) and once per update (another 2).
Unless you meant that the insert/update affected two rows each, in which
case the trigger(s) would get fired twice, once for the insert and once for
the update.



Relevant Pages

  • Triggers
    ... I am looking into creating triggers to populate a separate table whenever a ... Ellie ...
    (microsoft.public.sqlserver.programming)
  • Re: Computed columns vs Dynamically calculated columns (for celko)
    ... Another option along these lines (and which wouldn't require triggers) is to ... have a separate table but update it using a background process. ... very easily change how often you want to take the performance hit of making ... the calculations. ...
    (microsoft.public.sqlserver.programming)
  • Re: HOLES_IN_ZONE...
    ... Zone PFN ranges: ... Movable zone start PFN for each node ... So it's a block move in that 0x81f600-->0x81f7ff region which triggers ... commit 69fba2dd0335abec0b0de9ac53d5bbb67c31fc60 ...
    (Linux-Kernel)
  • Re: Detecting that a row has been updated.
    ... You can compare ROWVERSION for the specific data like client applications connects to the database and returns some data, then it performs some operations for example and when you are ready to commit the transaction, compare a row versuion of your old and new before commiting a transaction, so if they are different someone updated that row ... With the insertion it is possible to define a default, can something similar be done with updating? ... Triggers would be a possibillity, but I would prefer a default which get 'pasted' during the update and not use triggers. ...
    (microsoft.public.sqlserver.server)
  • Re: [Regression] 2.6.24-git3: Major annoyance during suspend/hibernation on x86-64 (bisected
    ... code paths (probably related to the disabling of nonboot CPUs), ... commit 764a9d6fe4b52995c8aba277e3634385699354f4 ... hm, this patch is a NOP, so it's weird that it has an effect. ... If the WARN_ONtriggers, and if you remove it, do things ...
    (Linux-Kernel)