I need to create a simple audit trigger for a table with 12 columns. I need to determine which row was changed. Is there a simple way to do that. The table structure is
Within the trigger, there are two views named inserted and deleted. These are the rows that caused SQL Server to launch your trigger. If you need to, you can use them to join back to your underlying table (usually only if you need to do an update based on logic in your trigger).
It is pretty obvious how to handle INSERT and DELETE triggers, but it helps to know that SQL Server treats an UPDATE statement as a DELETE then an INSERT (so you find the "before" and "after" update images in the views).