﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server 2005 Integration Services  / Auditing Insert Update and Delete Operations / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 11:07:48 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Auditing Insert Update and Delete Operations</title><link>http://www.sqlservercentral.com/Forums/Topic702951-148-1.aspx</link><description>I have always used audit tables and triggers for this type of auditing.  Yes, you could cause a problem if the application code is using @@Identity to return the latest identity value if you put an identity column in your audit table.  If you don't know what was used I would suggest not using an identity value on the audit table.  My audit table would add these columns to the columns in that source table:audit_action char(1) -- values would be I, U, D for insert, update, deleteaudit_date smalldatetimeThen your unique/primary key would be source_id, audit_date, audit_action.  Odds are the only joining you would do on the table will be on the source id you'd use that index for any join operations.  You could cluster on audit_date, but I would think that a heap would be okay in this instance.</description><pubDate>Thu, 23 Apr 2009 07:14:16 GMT</pubDate><dc:creator>  Jack Corbett</dc:creator></item><item><title>Auditing Insert Update and Delete Operations</title><link>http://www.sqlservercentral.com/Forums/Topic702951-148-1.aspx</link><description>I would like to put in place a process into the current oltp databases to facilitate the retrieval of 1) new records inserted; 2) updated records; 3) deleted records (if any).   I have an idea of using triggers to insert into an “audit” table the new, updated, deleted records with the appropriate timestamps on each.  There is a caveat to this approach: I am not 100% certain what the previous developers used for retrieving identity.  If they have not used the proper method ( i.e. @@Identity ), this can prove problematic to data integrity (e.g. wrong id’s used in a fk reference) especially if the audit tables have their own auto identity.   I would like to know is there any other solution apart from using triggers to implement this so analyze the and propose a strategy to implement a solution.</description><pubDate>Thu, 23 Apr 2009 02:08:42 GMT</pubDate><dc:creator>suresh kartheek malladi</dc:creator></item></channel></rss>