Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql server 2005 triggers

Author  Topic 

RichardSteele
Posting Yak Master

160 Posts

Posted - 2011-12-30 : 23:51:50
I want to keep track of whether a particular custnumber's data has changed in any of the 12 or so tables that include their data, by logging the datetime to a simple log table that has a custnumber field and a datetime field.

Can I create a trigger to automatically update this log table's datetime stamp whenever a particular custnumber's data is updated, deleted or inserted in their various tables?

If so what would that code look like?

Thanks in advance.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-01 : 02:09:51
yep..but you need to create separate triggers for each of tables as a trigger created on table will only track data changes in that table.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -