Table design

  • Hi,

    I'm writing this post to have some opinions of the best way to logging record creation and updates.

    Usually i create a column by each table with datacreation and user of creation because i need to know this information every time i access the record.

    I create a global log table where i log this information in a serialized way ( to be generic).

    So make sense to have this information in every table of my database.

    Someone has other ideas to log this type of information?

    Best Regards,

    Jorge

  • If you're working with SQL Server 2008, I'd go for using Change Data Capture. It's going to give you a lot more functionality, easily, than you can build yourself.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Hi,

    If you use pre MSSQL 2008 version, here is an article that describes table data auditing: Audit data using SQL Server 2005's COLUMNS_UPDATED function

    I have myself successfully used auditing this way. If you like, I can dig out some code, but the article should explain it.

    Cheers

  • How long do you need to keep this? And how is the data used? It can be handy to keep this information in each record, and it can reduce contention if you have a generic table that is constantly being written to with new records. However it depends on the level of activity? What is "busy" for your system?

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

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