Re: AFTER INSERT?
From: Jacco Schalkwijk (NOSPAMjaccos_at_eurostop.co.uk)
Date: 02/21/04
- Next message: cradaa: "Re: numbering my records based on a grouping"
- Previous message: Andrew John: "Re: AFTER INSERT?"
- In reply to: Bent Lund: "AFTER INSERT?"
- Messages sorted by: [ date ] [ thread ]
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!
- Next message: cradaa: "Re: numbering my records based on a grouping"
- Previous message: Andrew John: "Re: AFTER INSERT?"
- In reply to: Bent Lund: "AFTER INSERT?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|