SQL Server supports an OUTPUT clause as a part of DML statements that can help you in tracking changes made during any DML operation. The OUTPUT clause can save the result set in a table or table variable.

The functionality is similar to what triggers had with INSERTED and DELETED tables which accesses the rows that have been modified during DML operation.

Let’s take an example of changing the address by reversing it’s original value:

Let’s create an Address table using the below script:

Let’s add some data to the Address table using the below script:

Let’s now update the address: (Please observe the use of OUTPUT clause)

Once the record is updated, you can now check the values of both the records before the update and after the updates:


Note: You may also use the above logic to track any changes you do to the data and store it in a table.