Sometimes during batch job running, the below error will be thrown.
ERROR MESSAGE IN BATCHJOB:
SQL error description: [Microsoft][SQL Native Client][SQL Server]Could not complete cursor operation because the table schema changed after the cursor was declared.
The error message suggests that something updates the data while the query result it processing. If it’s the case, the bug is after the code you’ve shown, because that’s just the definition of the query, not the code doing something with it.
By the please use Insert > Insert code in the rich formatting view to insert code snippets. It’s almost unreadable without it.