January 8, 2025 at 4:01 pm
I have an issue when a stored procedure is executed from the SQL Server Agent it fails with the error, "Unknown token received from SQL Server [SQLSTATE HY000] (Error 0)." However, I can execute it locally in Management Studio just fine. I've scoured various resources about the error and behavior between the agent versus management studio but I'm not coming up with anything. I know my post doesn't contain much information but I'm taking a shot in the dark hoping someone has either experienced something similar or can point me in the direction of additional things to help troubleshoot.
January 8, 2025 at 4:14 pm
But other procs execute ok?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
January 8, 2025 at 4:51 pm
All other procs are fine. That's what is making this extra difficult. The proc completes locally within a few minutes so it's not an overly long-running proc too.
January 8, 2025 at 11:23 pm
is that proc using a linked server by anychance? that would be a possible reason for that issue (associated with incorrect/invalid credentials for the sql job account)
January 9, 2025 at 12:13 pm
It does use linked servers but I ruled that out since we specify the security context being used. Meaning any reference to the linked server uses the same SQL authenticated ID to link across regardless who executed it or where it is executed from. I also tried breaking out just the part that calls the linked server into its own job and it successfully executed. I will say this one proc actually has about 15-20 nested procs within it. The initial proc will run, call a new proc at the end, and keeps repeating that. It doesn't always fail with this error on the same proc but does tend to be on one that is about halfway through.
January 9, 2025 at 4:14 pm
I've been getting this error in SQL Agent jobs on several SQL 2016 servers intermittently since installing the latest security update (13.0.6455.2, 5046855 Security update for SQL Server 2016 SP3 GDR: November 12, 2024). Just today I may have tied it to the use of sp_MSforeachdb. Do you use that undocumented stored procedure?
P.S. I'm aware I shouldn't be using undocumented SPs and that alternatives exist.
January 9, 2025 at 4:23 pm
While we don't use that, I do find it very interesting that we are also running the same version. Several weeks ago I tried rolling it back but the issue still persisted so I'm not sure if parts don't fully rollback or what. Have you found any workarounds?
January 9, 2025 at 4:29 pm
I have not found a workaround yet. Interesting you uninstalled the update and it persisted. In my research, the error has occurred in the past and was tied to either a Windows update (I cannot make a similar connection) or an ODBC driver update. The ODBC driver was updated with the security update. I wonder if that did not roll back (although, not sure why SQL Agent would have an issue with that driver).
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply