Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Store mutiple identity values from insert
Message
De
16/07/2002 13:09:21
 
 
À
16/07/2002 09:38:09
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00674695
Message ID:
00679214
Vues:
20
>Would the inserted table in the trigger have the indentity values in it? I never tried that. If it does, it would be a simple matter to store them to another table.

Interesting question. I've never checked.

It appears that the Inserted table does contain the assigned IDENTITY values. You can see for yourself with the follow script:
USE pubs
CREATE TABLE testtable (c int identity(1,1), name nvarchar(40))

CREATE TRIGGER testtable_insert ON testtable FOR INSERT
AS
SELECT * FROM inserted

INSERT INTO testtable (name)
SELECT au_lname FROM authors

INSERT INTO testtable (name)
SELECT au_lname FROM authors
WHERE au_lname LIKE 'b%'
-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform