I have a query which is throwing an error. Query c...
# suiteql
r
I have a query which is throwing an error. Query contains a where clause that looks like this
Copy code
soTrans.entity = '113950' 
  AND l.id = '80'
  AND shipadd.city = "Coeur D' Alene" 
  AND shipadd.zip = '83815'
The inverted comma in the shippadd.city is causing this error.
Copy code
Invalid identifier 'Coeur D' Alene', only alphanumeric and underscore characters are allowed.
How will one handle this, in suiteql?
a
haven't tested it but I think you want
Copy code
AND shipadd.city = 'Coeur D'' Alene'
that's apparently how you escape single quotes in sql - note I'm not using double quotes for the outer quotes either
r
It's throwing an error failed to parse SQL. At that specific line.
Nevermind, your solution worked now. Thank you so much.
👍 1
e
I used to live in CdA!
r
What does the CdA abbreviation/slang stand for ? @Eric B
a
Coeur D' Alene - your problem city 😄
👍 1
r
😂😂
s
You could also use a wildcard?
Copy code
soTrans.entity = '113950' 
  AND l.id = '80'
  AND shipadd.city LIKE "Coeur D%" 
  AND shipadd.zip = '83815'
or escape the string?
Copy code
soTrans.entity = '113950' 
  AND l.id = '80'
  AND shipadd.city = STRING_ESCAPE("Coeur D' Alene")
  AND shipadd.zip = '83815'
r
I used a wildcard as the temporary solution until Anthony explained how to escape it. I didn't know about string_escape will check it out, thank you.