I have below data in Database: This is an example only. Data may be change
sustainability- energy
sustainability. energy
sustainability/ energy
sustainability; energy
sustainability* energy
sustainability: energy
sustainability, energy
sustainability energy
Current query is : select * from Table where description Like '%sustainability energy%'
I want to write a query which will return all above data .It should not be like '%sustainability%' because we dont what data may come. just an example.sustainability energy is a user search data.If it contain special character then also it should find.
Loading
Naveen KumarPosted Oct 9, 2024, 5:52 AM
You can use PATINDEX and LIKE:
PATINDEXlooks for patterns, where[^a-zA-Z0-9 ]represents any non-alphanumeric character (except space) between "sustainability" and "energy."LIKEis used to capture the simple case of "sustainability energy" without any special character in between.Check the below query
PinkuPosted Oct 9, 2024, 8:50 AM
Thanks Naveen :)