Reputation: 569
My requirement is to be able to search imran
in Simran
, Simrankaur
e.t.c
I am using following query:
select Name, Len(Name)
from Demo
where Contains(Name, '"*imran*"')
My Demo
table has Name
column with following entries Simran
, Simrankaur
, SimranKaurKhurana
but the query returns nil.
Where am I doing it wrong?
Upvotes: 1
Views: 51
Reputation: 2364
Try the following if your database is not case sensitive
select Name, Len(Name) from Demo
where Name like '%imran%'
Note that depending on database settings this may be case sensitive, so this might be more consistent:
select Name, Len(Name) from Demo
where LOWER(Name) like '%imran%'
Upvotes: 1
Reputation: 1269445
Sounds like you want like
:
select Name, Len(Name)
from Demo
where Name like '%imran%';
Even if you use contains, you can't use a wildcard at the beginning of the string.
Upvotes: 2