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:
01410282
Views:
57
>
>CREATE TRIGGER InsertPublication
>ON Publications
>AFTER INSERT
>AS
>BEGIN
>UPDATE Books
>SET NumPublications = NumPublications + 1
>FROM Books, inserted
>WHERE Books.ISBN = inserted.ISBN
>END
>
>
>I found this and other similar examples through a Google search. In each one there is a reference to "inserted". Is this a table?
>What is "inserted"?
>
>Thanks

The inserted and deleted tables are special tables available in Triggers. In SQL Server 2005 and up you can also access them using OUTPUT clause http://weblogs.sqlteam.com/mladenp/archive/2006/06/08/10122.aspx.

In DELETE command Deleted table would contain record(s) that was(were) deleted

In UPDATE Deleted would contain original values (before the update) and Inserted would contain new values

In Insert Inserted will contain just inserted records.
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