Tuesday, December 4, 2007

How do you search special character in the where clause

How do you search special character in the where clause

Search special character in the where clause

You can do so with the CHR function. As for the correct code, please refer to the ASCII table.

For example let’s say that you want to search for the string "GOD SAVE THE QUEEN"

All you need to do is

Sqlstr = "Select * from song WHERE lyrics =’" & CHR(34) & "GOD SAVE THE QUEEN" & CHR(34) & "’"

Rs.open Sqlstr, conn, 1,3

No comments: