Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help Understanding This Syntax
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01410281
Message ID:
01410303
Views:
26
>Back to my example. I'm not entirely sure what this trigger is doing.
>
>
>CREATE TRIGGER InsertPublication 
>ON Publications 
>AFTER INSERT 
>AS 
>BEGIN 
>	UPDATE Books 
>	SET NumPublications = NumPublications + 1
>               FROM Books, inserted 
>	       WHERE Books.ISBN = inserted.ISBN 
>END
>
>

For each inserted book information into the Publications table this trigger also updates Books table and increments NumPublications field.

In another words, say, you inserted two records into Publications table with the same ISBN, then Books table would have NumPublications field incremented by 2 for this Book.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform