SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Store proc or trigger


Store proc or trigger

Author
Message
hp_dba_uk
hp_dba_uk
Valued Member
Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)

Group: General Forum Members
Points: 69 Visits: 123
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...
Orlando Colamatteo
Orlando Colamatteo
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15073 Visits: 14396
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
hp_dba_uk
hp_dba_uk
Valued Member
Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)

Group: General Forum Members
Points: 69 Visits: 123
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.
Orlando Colamatteo
Orlando Colamatteo
SSCoach
SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)SSCoach (15K reputation)

Group: General Forum Members
Points: 15073 Visits: 14396
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search