Unknown token received from SQL Server [SQLSTATE HY000] (Error 0)

Mike Hanna 0 Reputation points
2025-02-10T15:53:45.2866667+00:00

After installing SQL Server patch 13.0.6455.2 for SQL Server 2016, one of our agent jobs is failing with Unknown token received from SQL Server [SQLSTATE HY000] (Error 0).

The job has one step that executes a stored procedure. The stored procedure runs without issue when invoked from SSMS manually. It only fails when called by the agent job.

I'm able to bypass the error by commenting out the line beginning with:

 CREATE INDEX IX_TEMP_STRUCT ON tempdb.dbo.

Note that the failure is not on the CREATE INDEX statement itself, but on the subsequent MERGE statement that references the temp table. The MERGE statement is dynamic SQL that is executed with sp_executesql().

This worked fine on the previous SQL Server 2016 patch level.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,492 questions
{count} votes

2 answers

Sort by: Most helpful
  1. LiHongMSFT-4306 31,311 Reputation points
    2025-02-11T06:10:24.9066667+00:00

    Hi @Mike Hanna

    This worked fine on the previous SQL Server 2016 patch level.

    Does the SQL Server Agent service account have the same permissions for the operation as previous? Pease double check the service account's permissions.

    Besides, check the SQL Server error logs, SQL Agent logs, and Windows Event Viewer for any relevant errors.

    Best regards,

    Cosmog


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

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