Once in a while my code encounters
System.Data.SqlClient.SqlException
The service has encountered an error processing your request. Please try again.
Error code 40540. A severe error occurred on the current command.
The results, if any, should be discarded.
Class 20
Number 40197
that happens very rarely, usually goes away in a minute or two and I can't reliably reproduce it. Sometimes Error code
can be a number other than 40540
.
I've Googled a bit and looks like it's usually triggered by bugs in SQL Server and is reproducible.
I have two options - retry the query or treat it as fatal and break hard. I'd prefer to have better understanding what the problem actually is and whether I'm safe retrying the query.
Do I retry the query when this error occurs?