Is there any way to create a DDL trigger, at the Database level, to run when na error is raised in that Database?
What I want is to create a controled log of the errors that arise from actions that would degrade database consistency without creating DML triggers on every table.
Mr. Google hasn't been nice to me and doesn't give me any answer!
The problema is on how to create a trigger that responds to a raiseerror event at the database level, not at the table level.
At the table level I can create na INSTEAD OF trigger and inside I'd put a TRY CATCH block. Easy.
What I want is to create some sort of error catching at the database level instead of creating INSTEAD OF triggers for all the 68 tables in my DB, or at least, some of them.
The purpose is to, on one side, prevent DB inconsistency (DELETING, UPDATING or CREATING referenced/invalid values), on the other for auditing purposes, WHO, WHEN and WHAT was tried.
Database reference rules and integrity allready prevents that in most cases but it leaves out the WHO, WHEN and WHAT.