Forum Discussion
Catch Error in a SQL Server Logon Trigger
- Dec 12, 2024
Yes, base on my test, I think it's correct.
So it is not a matter of writing a log in a table (transaction), or writing in a file (or using SQL).
The statement:
If an error goes on during logon trigger execution the user will NOT be able to log on (with or without try-catch).
... is correct ?
Yes, base on my test, I think it's correct.
- akaraulliDec 13, 2024Brass Contributor
Thank You very much rodgerkong.
This brings me to ...
Statement 2:
The CATCH is working, It is just that the Insert to SYS_ERROR_LOG is not persisted, because the insert was not persisted by an implicit auto-rollback at the end of trigger execution.
My expression on the body of this Discussion, "CATCH is not working.", is wrong.- rodgerkongDec 17, 2024Iron Contributor
But if you call rollback before the insert statement, the error log will work, because the implicit transaction has completed.