I need a set of SQL Server 2000 triggers (for multiple tables) that will - dependent on the data values - prevent UPDATEs/DELETEs to the row(s) "in perpetuity". (OK, there are some exceptions, but I can handle those.)
I have chosen to use the default type of trigger rather than an INSTEAD OF trigger, because it seems the latter will require much more logic & maintenance.
By using ROLLBACK TRANSACTION and RAISERROR, I have the basic trigger that prevents the UPDATE/DELETE. What I would like to have the trigger do in addition is to log the attempted UPDATE/DELETE to a table (first choice) or a file (second choice).
INSERTing a log record to a table has no effect, even if placed after the ROLLBACK TRANSACTION. Does anyone know of a simple workaround for this?
Alternatively, I might write to a file using xp_cmdshell, but the powers-that-be might object. Do any other easy alternatives come to mind?
I have chosen to use the default type of trigger rather than an INSTEAD OF trigger, because it seems the latter will require much more logic & maintenance.
By using ROLLBACK TRANSACTION and RAISERROR, I have the basic trigger that prevents the UPDATE/DELETE. What I would like to have the trigger do in addition is to log the attempted UPDATE/DELETE to a table (first choice) or a file (second choice).
INSERTing a log record to a table has no effect, even if placed after the ROLLBACK TRANSACTION. Does anyone know of a simple workaround for this?
Alternatively, I might write to a file using xp_cmdshell, but the powers-that-be might object. Do any other easy alternatives come to mind?