Inserted and deleted tables are 2 pseudo tables preseting the before and after images of modified rows. They can only be accessed from within triggers. Those two have been around for quite long time but it’s hard to find any articles to tell how they are populated. Some rumors said they are retrieved from transaction logs in SQL Server 2000. Recently, I was asked to evaluate the performance impact of using trigger for my customer’s project. I did some investigation and got some interesting results.
trigger
Change Default DML Behavior
DML, Data Manipulation Language, is used to add data to table and modify existing rows in tables. There are 3 commands
- Insert : insert records to a table
- Delete: remove records to a table
- Update: modify records in a table
In SQL Server, you are allowed to change the default behaviors of those 3 commands. For instance, while inserting a record, the new record can be applied to a table as an update(can be a delete as well).