How to escape the "\" character in Advanced Query SQL for against SQL Server?

How to escape the "\" character in Advanced Query SQL for against SQL Server?

  

How to escape the "\" character in Advanced Query SQL for against SQL Server?

I am trying to use the following expression in an Advanced Query SQL
 SUBSTRING(SMSTopConsoleUser, 1, CHARINDEX('\', SMSTopConsoleUser) - 1) as SMSTopConsoleUserDomain  

It executes correctly when ran on the SQL Server however Outsystems escapes the "\" as "\\" which causes the statement to fail.
I tried changing it to "\\" in my expression but that just gets interpreted to "\\\\".
How can I prevent this from happening?

We are running on platform 9.1.605.0

Should work if you remove -1

SUBSTRING(SMSTopConsoleUser, 1, CHARINDEX('\', SMSTopConsoleUser) ) as SMSTopConsoleUserDomain

I tried that, which doesn't address the issue I am having.

The character \ in the SQL tab of gets changed to \\ when viewing Executed SQL tab no matter where it exists in a query.

How about this. Add a parameter call it Slash. Set Expand Inline to Yes. Set value to "'\'" ..note the single quotes within the double quotes.
My query is like this

SELECT SUBSTRING({Customer}.[FirstName], 1, CHARINDEX(@Slash , {Customer}.[FirstName])) as SMSTopConsoleUserDomain From {Customer}

Then the executed SQL looks like this.
SELECT SUBSTRING( [OUTSYSTEMSSANDBOX].DBO.[OSUSR_TRG_CUSTOMER].[FIRSTNAME], 1, CHARINDEX('\' , [OUTSYSTEMSSANDBOX].DBO.[OSUSR_TRG_CUSTOMER].[FIRSTNAME])) as SMSTopConsoleUserDomain From [OUTSYSTEMSSANDBOX].DBO.[OSUSR_TRG_CUSTOMER]