sql-serversql-server-2012sql-agent-job

SQL Job error: The query processor could not produce a query plan


Running this SQL from a SQL Server Agent Job:

delete p
from sometable p
join sometable_deletes src on src.primarykeyid = p.primarykeyid

But I get this error:

Error: 8624, Severity: 16, State: 116.
Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services.

The SQL runs fine directly in SQL Server Management Studio. Also, from a SQL Server Agent Job, I can run a similarly structured delete statement fine with different tables. But there is something wrong with this particular statement.

How can I figure out what the actual issue is here? Or get more error info?


Solution

  • I have no idea why, but adding this to the top of the SQL in the SQL Server Agent Job resolved the issue for me:

    set QUOTED_IDENTIFIER ON