Using SQL Server 2008 R2:
How can I write to the SQL Server Error Log? I have a ROLLBACK statement that I'd like to couple with a statement written to the error log for external monitoring.
BEGIN TRAN INSERT INTO table1 SELECT * FROM table2 IF @@ERROR <> 0 BEGIN ROLLBACK TRAN --Write to log RETURN END COMMIT TRAN
I'd like to clarify - I want to write to the "SQL Server Logs", "Current" log, under the "Management" folder in the object explorer.