Easy way to store changes to a table

  • What i'm looking for is does sql have a built in function or stored procedure or even trigger, that if I change a field in a table that it will recognize a change and can have it insert into a temp table? Or if one does not exist how would I go about doing something like it?

  • Are you asking about dml changes or ddl changes? If it's the former, look to BOL under Triggers. If it's for ddl, look at BOL for DDL triggers. I also have what I consider to be a pretty neat ddl trigger / auditing of sorts posted on my blog. http://datarealized.wordpress.com/2009/04/29/schema-management-ddl-triggers/

    hth

    edit: heh, feel like a dolt. Didn't notice that this was on the 2k8 forum. Yeah, try cdc as Gail mentioned below.

  • Since you're on SQL 2008, take a look at Change Tracking, Change Data Capture and SQL Audit. I'm sure one of them will serve your purposes.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply