Store proc or trigger

  • I have a situation where, we have

    SQL Server 2005 Standard edition SP4

    - Over 100 little table per customer

    - each table have around 40 rows

    - each table contains variable and value assinged as configuration

    Now any of these variable/vaule pair can be changed for any of the cust table. I need a way of tracking the old value and new value as once the value is overriden its gone unless I manully store them somewhere.

    Now I know that trigger would have to be per table which means too many of them hence perfromane issue. So I think Store proce would be the way forward but I am kind of stuck at design level.

    Any pointers would be great..so far I know that

    1. I need an archive table

    2. track any changes - here is my issue e.g. what parameters to use so all linked etc..

    3. right them to archive table first

    4. update original table

    I am not a developer so I could do with any help. Thanks in Advance...

  • Know that the number of triggers is not the determining factor for performance. Instead consider the complexity of the trigger and the volume and frequency of transactions against these tables. For the majority of databases adding a trigger to each table for each type of operation (update & delete) to create an audit trail will be suitable.

    You did a nice job of relaying your project requirements clearly however this is a forum with unpaid volunteers and you have a fair bit of work ahead of you. You could search the web for examples of "generic audit triggers" for SQL Server (or similar phrases) to see if someone has provided something you can pickup and use as-is. Since you said you're not a developer you may want to consider hiring a professional to assist you with this.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Sorry for the delay but I have sorted this using a store proc utilising dynamic sql. It wasnt that hard to be honest. Its been deployed in our prod env and working fine.

  • Are you saying you created one stored proc that handles inserts, updates and deletes for over 100 tables using dynamic sql?

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

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

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