July 8, 2009 at 5:25 am
hello,
I have problem when I send a request seeking a field containing an apostrophe.
eg:
I have a table Document containing Title field, then this field contains the string: it's Sabra and Chatilla
I send this query to the server:
SELECT * FROM Document WHERE Title='it''s Sabra and Chatilla'
but it does nothing. I am sure it is the apostrophe that produces this result because I have done extensive testing to be sure
do you now a solution for that?.
help me please.
July 8, 2009 at 8:31 am
The following works:
create table #Document (Title varchar(64))
insert into #Document
select 'it''s Sabra and Chatilla'
SELECT * FROM #Document
WHERE Title='it''s Sabra and Chatilla'
drop table #Document
You mention the Title field "contains" this string, what if you run this:
SELECT * FROM #Document
WHERE Title like '%it''s Sabra and Chatilla%'
- Jeff
July 8, 2009 at 9:01 am
it does no result no error.
i can't no why it happends
July 8, 2009 at 9:08 am
Maybe run something simpler like:
SELECT Title FROM Document WHERE TITLE LIKE '%Sabra%'
and if that doesn't return anything, run this just to confirm you have something there at all:
SELECT Title FROM Document
- Jeff
July 8, 2009 at 9:17 am
this query give a result
SELECT Title FROM Document WHERE TITLE LIKE '%Sabra%'
i have a title like it's Sabra and Chatilla .
i want to search with complete title. but it dosen't work. no result found. i don't know how to find soluion at this prob.
July 8, 2009 at 10:15 am
you're mis-spelling the title in your query somehow. make sure it is exactly what it is in the database, that there are no hidden characters in the field and, if your collation is case sensitive that you have the correct case
July 8, 2009 at 10:18 am
also, verify that what you're calling an apostrophe is character 39 (') and not 96 (`)
July 8, 2009 at 3:22 pm
i found a space at the end of title. apostrophe is 39(').
but when i did upper(TitreDoc) = upper('C''était hier sabra et chatila').
it doesn't work, no result. i think that the é which cause the pb.
if i erase the upper function the query give result.
July 8, 2009 at 3:22 pm
i found a space at the end of title. apostrophe is 39(').
but when i did upper(TitreDoc) = upper('C''était hier sabra et chatila').
it doesn't work, no result. i think that the é which cause the pb.
if i erase the upper function the query give result.
July 8, 2009 at 3:56 pm
i found a space at the end of title. apostrophe is 39(').
but when i did upper(TitreDoc) = upper('C''était hier sabra et chatila').
it doesn't work, no result. i think that the é which cause the pb.
if i erase the upper function the query give result.
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply