August 3, 2017 at 11:24 pm
Are all errors logged on try catch ? I ran the code and manually killed the connection, for some reason didn't get logged. It did do the rollback though. I would like to capture errors in all scenario's also like when server is crashed.
August 4, 2017 at 1:12 am
curious_sqldba - Thursday, August 3, 2017 11:24 PMI ran the code and manually killed the connection, for some reason didn't get logged. It did do the rollback though. I would like to capture errors in all scenario's also like when server is crashed.
How would a disconnection be caught in the catch block? If the session no longer exists, the catch in that session cannot run. Same with a server crash. The catch can't run, because the server's not available to run it
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 4, 2017 at 8:21 am
But it should be able to rollback right? If the server crashes i am thinking once the server is back it should rollback all the uncommitted transactions. Really i am trying to avoid a situation where i have inserted but not deleted the data or vice versa.
Appreciate your feedback.
August 4, 2017 at 8:54 am
curious_sqldba - Friday, August 4, 2017 8:21 AMIf the server crashes i am thinking once the server is back it should rollback all the uncommitted transactions. .
Um, you do know that's what SQL does automatically as part of its startup process?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
August 4, 2017 at 9:31 am
Got it.
Looks like my Try/Catch is not trapping all errors. For example if the table name is wrong it doesn't log.
August 4, 2017 at 9:43 am
Parse-time and binding errors occur before any portion of the code starts to execute, and hence can't be caught by try-catch.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 6 posts - 16 through 20 (of 20 total)
You must be logged in to reply to this topic. Login to reply