Failed to execute query.

Vaibhav Lambat 21 Reputation points
2022-10-18T06:49:54.507+00:00

Error: A severe error occurred on the current command. The results, if any, should be discarded. Operation cancelled by user.

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. SSingh-MSFT 16,461 Reputation points Moderator
    2022-10-19T09:21:04.157+00:00

    Hi @Vaibhav Lambat ,

    Thanks for the reply.

    The issue looks strange. I would suggest you to please check few points:

    1). This might be caused due to Corrupted Index. Reindexing the table could fix the problem.
    2). Check if you're out of disk space or low on memory.

    Additionally, please refer to the link kb3139489-fix-a-severe-error-occurred-on-the-current-command-when-a-table-valued-user-defined-function-is-referred-to-by-a-synonym and sql-server-error-on-update-command-a-severe-error-occurred-on-the-current-com with details about this error handling.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    0 comments No comments

  2. Alberto Morillo 35,401 Reputation points MVP Volunteer Moderator
    2022-10-19T12:24:33.387+00:00

    You should be getting error number 40540 that usually comes with that error message and for this error it is recommended a retry logic should be implemented.

    Documentation used to have this explanation:

    The service has encountered an error processing your request. Please try again. Error code %d. You will receive this error, when the service is down due to software or hardware upgrades, hardware failures, or any other failover problems. Reconnecting to your SQL Database server will automatically connect you to a healthy copy of your database. You may see error codes 40143 and 40166 embedded within the message of error 40540. The error codes 40143 and 40166 provide additional information about the kind of failover that occurred. Do not modify your application to catch error codes 40143 and 40166. Your application should catch 40540 and try reconnecting to SQL Database until the resources are available and your connection is established again.

    Your application should catch 40540 and try reconnecting to SQL Database until the resources are available and your connection is established again.

    See this forum thread in StackOverflow for more information.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.