hengert (7/18/2008)
Hi,I am in no way a db expert, but I am required to create a generic trigger to track changes to a few tables. We don't want to write a specific trigger for each table. We would like to enter the data that has been updated, inserted, deleted into a "generic" table that looks like this:
May I advise, if you want to go that kind of route, write a procedure to generate triggers for each table based on the system tables.
Looping through the system tables within the trigger is going to increase the time the triggers take to execute, lengthening the transactions and making it more likely that you'll have blocking problems.
So, you would have a proc that generated and executed the CREATE TRIGGER .... sstatement based on the table name and the columns in it.
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