I am trying to run some code in SQL 2000 query analyzer.
I want to
SELECT all columns from the Publishers database
WHERE pubs_name is LIKE a supplied strSearch
(the string can be anywhere in the pubs_name)
When I do a syntax check on the code below I get the following SQL errors.
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near ', '.
Server: Msg 105, Level 15, State 1, Line 2
Unclosed quotation mark before the character string '
'.
Here is the code I am trying to execute.
SELECT pubs_name FROM Publishers
WHERE pubs_name LIKE '%" & Replace(strSearch, "'", "''") & "%'
Can someone please point me in the right direction?
Thanks in advance for your time.
Tim
I want to
SELECT all columns from the Publishers database
WHERE pubs_name is LIKE a supplied strSearch
(the string can be anywhere in the pubs_name)
When I do a syntax check on the code below I get the following SQL errors.
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near ', '.
Server: Msg 105, Level 15, State 1, Line 2
Unclosed quotation mark before the character string '
'.
Here is the code I am trying to execute.
SELECT pubs_name FROM Publishers
WHERE pubs_name LIKE '%" & Replace(strSearch, "'", "''") & "%'
Can someone please point me in the right direction?
Thanks in advance for your time.
Tim