Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
T-SQL Newbie creating trigger
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01031991
Message ID:
01032020
Views:
18
>
>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--
Previous
Reply
Map
View

Click here to load this message in the networking platform