On 4/9/08, Richard Klein <[EMAIL PROTECTED]> wrote: > > Richard Klein <[EMAIL PROTECTED]> > > wrote: > >> One question: I thought that the '\' character is not part of the > >> SQL standard. (That's why I specified '/' instead as my ESCAPE > >> character). > > > > I'm not sure I understand. You can use any character as an escape > > character. E.g. LIKE '2!_%' ESCAPE '!'. A backslash is as good as any. > > > > Igor Tandetnik > > I'm a SQL newbie, so I may very well be wrong about this ... > > My understanding is that you can use any legal SQL character as an escape > character, but that a backslash is not a legal SQL character. > > I got this impression from a sentence I read on the SQLite website (in > the description of literal numeric values): > > "C-style escapes using the backslash character are not supported because > they are not standard SQL." >
If I understand correctly Igor Tandetnik's comment "A backslash is as good as any.", in the above quote the phrase "they are not standard SQL" refers to C-style escapes and not to the use of the backslash character as an escape defined with ESCAPE. LIKE '2\_%' is not valid. LIKE '2\_%' ESCAPE '\' is valid. Robert Wishlaw > So then I checked the spec, and found syntax definitions (reproduced at > the end of this email) that do seem to confirm that backslash ('\') is > not a legal SQL language character. > > I haven't checked to see whether SQLite accepts backslash as an escape > character. > > - Richard Klein > > ========================================================================== > > <SQL language character> ::= > <simple Latin letter> > | <digit> > | <SQL special character> > > <simple Latin letter> ::= > <simple Latin upper case letter> > | <simple Latin lower case letter> > > <simple Latin upper case letter> ::= > A | B | C | D | E | F | G | H | I | J | K | L | M | N | > O > | P | Q | R | S | T | U | V | W | X | Y | Z > > <simple Latin lower case letter> ::= > a | b | c | d | e | f | g | h | i | j | k | l | m | n | > o > | p | q | r | s | t | u | v | w | x | y | z > > <digit> ::= > 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 > > <SQL special character> ::= > <space> > | <double quote> > | <percent> > | <ampersand> > | <quote> > | <left paren> > | <right paren> > | <asterisk> > | <plus sign> > | <comma> > | <minus sign> > | <period> > | <solidus> > | <colon> > | <semicolon> > | <less than operator> > | <equals operator> > | <greater than operator> > | <question mark> > | <underscore> > | <vertical bar> > > <space> ::= !! space character in character set in use > > <double quote> ::= " > > <percent> ::= % > > <ampersand> ::= & > > <quote> ::= ' > > <left paren> ::= ( > > <right paren> ::= ) > > <asterisk> ::= * > > <plus sign> ::= + > > <comma> ::= , > > <minus sign> ::= - > > <period> ::= . > > <solidus> ::= / > > <colon> ::= : > > <semicolon> ::= ; > > <less than operator> ::= < > > <equals operator> ::= = > > <greater than operator> ::= > > > <question mark> ::= ? > > <left bracket> ::= [ > > <right bracket> ::= ] > > <underscore> ::= _ > > <vertical bar> ::= | > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users