Escaping ampersand character in SQL string

Instead of

node_name="Geometric Vectors \& Matrices"

use

node_name="Geometric Vectors " || chr(38) || ' Matrices' 

38 is the ascii code for ampersand, and in this form it will be interpreted as a string, nothing else. I tried it and it worked.

Another way could be using LIKE and an underline instead the ‘&’ character:

node_name LIKE 'Geometric Vectors _ Matrices' 

The chance that you’ll find some other record too, which is different in only this one character, is quite low.

Leave a Comment