Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
chava_sree
Yak Posting Veteran
56 Posts |
Posted - 2008-07-29 : 11:51:57
|
Hi all,I want to escape double quotes passing from a string into a stored procedure.. here is the actual query i used to escape double quotes but nothing seems to work, *************SELECT * FROM TABLEWHERE USER_FIRSTNAME LIKE +'%'+'"'+@ss+'"'+'%'or USER_LASTNAME LIKE +'%'+'"'+@ss+'"'+'%'or TITLE LIKE +'%'+'"'+@ss+'"'+'%'********************@ss is the string which has double quotes and using a like operator.Appreciate your help.thanks |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-29 : 11:54:44
|
use REPLACE function. look into books online for syntax & usage. |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-07-29 : 11:57:02
|
Did you try using teh ESCAPE clause?From BOL:match_expression [ NOT ] LIKE pattern [ ESCAPE escape_character ] Example:SELECT c1 FROM mytbl2WHERE c1 LIKE '%10-15!% off%' ESCAPE '!' |
|
|
chava_sree
Yak Posting Veteran
56 Posts |
Posted - 2008-07-29 : 12:17:06
|
ESCAPE '"' doesn't work for me.. i used replace function like this below..but still doesn't work.. any cluesselect @sss = REPLACE(@ss, '"', '''') |
|
|
chava_sree
Yak Posting Veteran
56 Posts |
Posted - 2008-07-29 : 12:24:06
|
am using @ss variable inside a like operator " like '%@ss%' that's y am unable to apply replace.. |
|
|
chava_sree
Yak Posting Veteran
56 Posts |
Posted - 2008-07-29 : 12:31:10
|
i got itselect @sss = REPLACE(@ss, '"', '')used two single quotes to solve it |
|
|
|
|
|