I am trying to write a query to find a string withing a string. In Oracle I used regexp_like but I don't see such function in SQL Server 2016. I have a table that has an address column such as:
ADDRESS
--------
345 E 149 ST NY NY
345 EAST 149 STREET NY NY
444 CHEST AVE NY NY
444 CHEST AVENUE NY NY
I want to write a query that search for 345 [E OR East] follow by 149. in the case of 444 chest, I want a query to search for 444 chest[ ave or avenue].
I have something like the following which doesn't work
select * from table1 where address like '345[EEAST] 149%'
Basically I want to tell the query to get any address that start with 345 E or 345 EAST follow by 149.
Can someone help me write a query for this? I know I can use OR clause with two different address but if I have multiple addresses with different pattern then OR clause will not be efficient method. I'm looking into using some type of regular expression.
%for it to be any use. Otherwise try charindex or patindex. Thats what is on offer with SQL Server.