Database Auditing ( Urgent )
-
Dear all, I have the following case: In a SQL db, each time a row is changed in a specific table ( say OriginalTable ) i need to insert a row for each changed column in a specific table say ( HistoryTable ) by the following values: 1- The OriginalTable Column name ( i.e. the column that its value is changed ) 2- The Old value ( existing before the update process ) 3- The New value ( existing after the update process ) I dont know if this can be done using SQL or programmatically from the code. Plz, if anyone know the solution of that problem using any SQL or Code reply me as soon as possible. ( Note : my application is an ASP.Net c# project) thank u all Rania Adel
-
Dear all, I have the following case: In a SQL db, each time a row is changed in a specific table ( say OriginalTable ) i need to insert a row for each changed column in a specific table say ( HistoryTable ) by the following values: 1- The OriginalTable Column name ( i.e. the column that its value is changed ) 2- The Old value ( existing before the update process ) 3- The New value ( existing after the update process ) I dont know if this can be done using SQL or programmatically from the code. Plz, if anyone know the solution of that problem using any SQL or Code reply me as soon as possible. ( Note : my application is an ASP.Net c# project) thank u all Rania Adel
Hi Rania. If your RDBMS supports triggers, I think you would want a trigger for this sort of thing. What's your brand of database?
-
Hi Rania. If your RDBMS supports triggers, I think you would want a trigger for this sort of thing. What's your brand of database?
-
Hi Mike, yes it support triggers, and there is already a trigger that perform the task i need, but its very very very slow, and i am responsible of doing it programatically or to enhance the trigger Thank u Rania Adel
Hi Rania. Well, I think using a trigger is going to be your best bet for performance, over, say, additional C# code that would execute a separate command that the DB has to process anyway. Is your trigger doing other things besides the insert into your history table that would slow it down? Is the history table indexed? huge too? Is it possible the slowness is coming from having to refresh indexes on each insert to the history table?