I realize that this is an old post but I think it might be good for others that see this question to get some guidance on the issue....
The query that will be sent to SQL Server has to be between a SQL and a semicolon. Everything between the SQL and the ; will be sent to SQL Server via the driver (most often ODBC) that the CONNECT statement in the load script use.
So having a semicolon in the middle of the query is not going to work well.
The semicolon in the middle of the query does not seem to be part of a SQL Server T-SQL syntax. It is most certainly something that a query tool would accept as a separator between SQL statements that can be sent to SQL Server. Each SQL specification in a Qlik load script has to contain one and only one SQL statement.
The query being sent should probably look like this:
CAST(EVENT_PAYLOAD.query('data(/xx:SAE-RECORD/xx:BATCH_ID)') as varchar(250)) BATCH_ID
1=1 AND EVENT_TYPE = 'EXPENSE_GL'
--AND CREATION_DATE > GETDATE() - 1
FOR XML PATH('xx:root')
The last line has been added and and it might be necessary with a different specification after FOR XML. A semicolon has been remove between the WITH..... and the SELECT. According to Microsoft documentation it shouldn't be any semicolons between a WITH and the following SELECT.