Re: AFTER INSERT?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jacco Schalkwijk (NOSPAMjaccos_at_eurostop.co.uk)
Date: 02/21/04


Date: Sat, 21 Feb 2004 11:58:33 -0000

Yes,

CREATE TRIGGER <trigger name> ON <table name> AFTER INSERT
AS
.........

If you have an identity column you can really reset the value from within a
trigger, because you need to do that with DBCC CHECKIDENT(), and permissions
on that are limited to the table owner and members of the sysadmin, db_owner
and db_ddladmin roles, and are not transferable.

But it sounds like you attach some meaning to the value of the identity
column, which is for various reasons not a good thing to do. Values in the
identity range "go missing" when a transaction is rolled back for example.

-- 
Jacco Schalkwijk
SQL Server MVP
"Bent Lund" <bstlu@online.no> wrote in message
news:OLfup3G%23DHA.1472@TK2MSFTNGP11.phx.gbl...
>
>
> Hi, is there a After Insert trigger functionality in SQL Server 2000?
>
>
> After I have inserted records (system allows for max 8 records to be
> inserted at one time) I need to check the PK field (int Autoincrement)
> and reset it if it has passed a certain limit.
>
> It appears that I cannot do this WHILE I am inserting, so it has to be
> checked after a insert.
>
>
> Best regards,
> Bent
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Relevant Pages

  • Re: @@IDENTITY in SQL server
    ... sent through to the Execute statement of a connection object), ... guaranteed to get the identity column of the record that was just ... If the table into which you are inserting has a trigger that inserts data ...
    (microsoft.public.inetserver.asp.db)
  • Re: need time delay 555 / 556 circuit help
    ... but will allow the first timer to trigger on as ... soon as the reset voltage to> 1.2V. ... > Adding the following circuit to the second timer should prevent it ...
    (sci.electronics.basics)
  • Re: Generate synchronous signals
    ... during the reset block. ... Right now if you reset while trigger is high, ... parenthesis helps split the statement visually off the condition. ... indentation for the statements within a block the same as indentation ...
    (comp.lang.verilog)
  • Re: 555 monostable basics
    ... *while it is already triggered by the first pulse, ... If It's being triggered by the Trigger input, ... the first initial cycle, how ever, you can force a reset of the time ... would behave in such a manner that would confuse others that didn't know ...
    (sci.electronics.basics)
  • Re: Triggring a 555 timer in monostable mode with a compartor output
    ... pin and a .1uf from the RESET pin to common.. ... reset of the timer on initial power of Vcc. ... short SINK pulse on the trigger during initiation. ...
    (sci.electronics.basics)