Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
When searching for a client name that contains an apostrophe, if you enter only a part of the name, no records are returned. You must enter the entire name in order to get records returned.


Example :

Data Entered Records Returned
Robin O’ None
Robin O’N None
Robin O’Ne None
Robin O’Nea None
Robin O’Neal Correct record

Please let me know on this....
Posted
Comments
Mehdi Gholam 18-Nov-11 4:35am    
What is the query you are using? Are you using the % character at the end.
Al Moje 18-Nov-11 4:48am    
I think when saving record(s) in database containing an apostrophe should be avoided. These may be manipulated/replace with other character such as single quote. this is just a trick but it function will. This also requires manipulation when retrieving back from select query... I am not saying that this should be the way but maybe there were some other best way..
Sergey Alexandrovich Kryukov 18-Nov-11 14:17pm    
Yes, where is your query sample?
--SA

1 solution

Always post your code/query in your question for quick response otherwise you won't..

Here you go
SQL SERVER – Tips from the SQL Joes 2 Pros Development Series – Finding Apostrophes in String and Text – Day 3 of 35[^]

For your information
SQL Server LIKE[^]
SQL Server Reference Manual - Wildcard Characters[^]
 
Share this answer
 
Comments
Sander Rossel 19-Nov-11 8:48am    
My 5 for the links. Especially the first one.
When I tried something similiar for the first time I ended up with something like '''''''''' :D

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900