Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
T-SQL Newbie creating trigger
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01031991
Message ID:
01032020
Vues:
17
>
>This is my new code, it works fine.
>
>
>
>CREATE TRIGGER [ReceptionDetail$UPDATE] ON [dbo].[IN_ReceptionDetail]
>FOR UPDATE
>AS
>
>
>IF UPDATE(nQuantiteRecu)
>	BEGIN
>		UPDATE  IN_ItemEntrepot SET  nEnMainQuantite =  nEnMainQuantite - 
DELETED.nQuantiteRecu + INSERTED.nQuantiteRecu FROM IN_ItemEntrepot
>		JOIN INSERTED ON  INSERTED.fk_Item =  IN_ItemEntrepot.fk_Item 
AND  INSERTED.fk_Entrepot =  IN_ItemEntrepot.fk_Entrepot
>		JOIN DELETED ON DELETED.ID =  INSERTED.ID
>	END
>
>
>
>
>Do you see any beginner's error in there?
>And, in a trigger there is no current record pointing on a row?

No, there's no current record and there cannot be because a trigger fires once per a SQL statement not per a row.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform