This may have less to do with the raw query, and more to do with the actual code you're using to interact with the server. Are you using a default action that shipped with Blue Prism, or is this one you wrote? If the former, which action are you using? If the latter, are you able to provide a sanitized copy of the code?