Reputation: 43
Searching records by first letters of any word in string.
I need to search records by multiple probes from single row in sql
e.g.
Table:
AcCode AcTitle
1 Hussain Mills Limited
2 Nishat Chunian Limited
3 Nishat Mills Limited
4 MCB Bank Limited
5 Allied Bank Limited
Required
When searched by string "Ni Lim" should return record 2 and 3
When searched by string "Bank Li" should return record 4 and 5
Upvotes: 0
Views: 43
Reputation: 1269623
Hmmm. I think you can do this with replace()
and like
:
select t.*
from table t
where acTitle like '% ' + replace(@string, ' ', '% ') + '%'
Upvotes: 2