Help needed for a serach condition in sql [modified]
-
Hi Friends, I have a data like in a name field like below Martins Martin's how can I get both record when some one passes in search input string only Martins i.e if I pass Martins It should return both Martins and Martin's it is a specific case, think in general where uer will pass Martins not Martin. johns not john only can i remove ( ' ) it from field in where condition if yes then how? If you need further explination please do not hesitate to ask.
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
modified on Thursday, May 15, 2008 8:25 AM
-
Hi Friends, I have a data like in a name field like below Martins Martin's how can I get both record when some one passes in search input string only Martins i.e if I pass Martins It should return both Martins and Martin's it is a specific case, think in general where uer will pass Martins not Martin. johns not john only can i remove ( ' ) it from field in where condition if yes then how? If you need further explination please do not hesitate to ask.
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
modified on Thursday, May 15, 2008 8:25 AM
-
Hi Friends, I have a data like in a name field like below Martins Martin's how can I get both record when some one passes in search input string only Martins i.e if I pass Martins It should return both Martins and Martin's it is a specific case, think in general where uer will pass Martins not Martin. johns not john only can i remove ( ' ) it from field in where condition if yes then how? If you need further explination please do not hesitate to ask.
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
modified on Thursday, May 15, 2008 8:25 AM
Use like operator like this: Select * from tablename where name like 'martin%'
Piyush Vardhan Singh p_vardhan14@rediffmail.com http://holyschoolofvaranasi.blogspot.com http://holytravelsofvaranasi.blogspot.com
-
Hi Friends, I have a data like in a name field like below Martins Martin's how can I get both record when some one passes in search input string only Martins i.e if I pass Martins It should return both Martins and Martin's it is a specific case, think in general where uer will pass Martins not Martin. johns not john only can i remove ( ' ) it from field in where condition if yes then how? If you need further explination please do not hesitate to ask.
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
modified on Thursday, May 15, 2008 8:25 AM
-
select * from myTable where soundex(ColValue) = soundex('john''s')
I Love T-SQL "Don't torture yourself,let the life to do it for you."
select organisationname from organisation where soundex(organisationname) = soundex('martins') I used your query , my question was if Input martins it also return record including martin and martin's. so its not returnt record which have martin's in it.
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
-
select organisationname from organisation where soundex(organisationname) = soundex('martins') I used your query , my question was if Input martins it also return record including martin and martin's. so its not returnt record which have martin's in it.
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
I have tested by giving input string
'martins'
and'martin''s'
and query returns two rows with values martin and martin's (those values are stored on database).select organisationname from organisation where soundex(organisationname) = soundex('martins')
and the next query gives me same resultselect organisationname from organisation where soundex(organisationname) = soundex('martin''s')
I Love T-SQL "Don't torture yourself,let the life to do it for you."