Question

is it possible to declare one Sql Trigger Insert, Update, Delete for all tables in the database instead of creating a separate trigger for each table? I just want a simple history of what actions have been taken e.g. TABLE A deletes a row ,TABLE B updates a row ,TABLE C Add new row .. and the trigger will insert a new row to another table with that information I want.

Was it helpful?

Solution

No, a trigger can only be defined on a specified table.

You should read up on the auditing features of SQL Server (http://technet.microsoft.com/en-us/library/cc280386.aspx). They are more performant and more flexible in what you want to achieve. Unfortunately they are not available in the Express Edition.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top