Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserted table
Message
De
25/02/2002 17:34:33
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Inserted table
Divers
Thread ID:
00624840
Message ID:
00624840
Vues:
38
Hi,

New to SQL Server Triggers. My understanding is that when a field is updated, the old row is inserted into a temporary table called 'deleted' and the new data is written into a temporary table called 'inserted'.

I'm trying to access the new data in a trigger (in order to update a second table) by doing a select on the 'inserted' table. The problem: the select on the 'inserted' table never returns any rows. Is this the right approach? If not, what would be the right approach?

The code within the trigger:


CREATE TRIGGER trUpdateAnalVerification ON
[ERA_IL_Study_Analytes_Verification]
FOR UPDATE AS

DECLARE newdata2 CURSOR FOR
SELECT study FROM inserted

OPEN newdata2

/*See if any rows were opened*/
INSERT gerrystest VALUES(CAST(GETDATE() AS varchar(25)) + ', after open, ' + CAST(@@ROWCOUNT as char(5)


CLOSE newdata2
DEALLOCATE newdata2
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform