• Home /
  • Blog /
  • How to add audit trigger on a list of tables
sql-server-tutorials.png

How to add audit trigger on a list of tables

For audit purpose you may be requested to add ModifyDate and ModifyBy columns for all your tables and create an audit trigger to automatically update that columns as soon as record was updated or inserted.

It is very easy to implement when you have one or two tables, but with 20-30 tables it may take time. But this task can be automated.

In the following script a temporary table created which will contain list of all tables required audit, and later table name and primary key name will be used for new column creation and creation of audit trigger on each table.


Comments

Search

Yaplex logo white text

Yaplex is an IT Consulting and .NET development company co-founded by .NET Developer Alex Shapovalov who lives in Mississauga and provides software development services in Toronto, Mississauga, and GTA.

Contact Information

Toronto, Canada
Phone: +1 647 328 3809