I’m trying to do address matches between an array of three-word strings (each an address) and a column (“address”) in a SQL Server database. For example I have a string 123 main st in this array variable and an entry from the column of interest with 123 main st. #A1. The following are what I’d like my query or script to do.
- find this entry
123 main st. #A1 - find any entries with strings
1123,main, andst - ignore order
- ignore letter case
What’s an efficient and fast way to approach this problem? I’m doing this in the following way. This is how I’m doing it right now:
SELECT *
FROM some_table
WHERE UPPER(address) LIKE UPPER('123%')
AND UPPER(address) LIKE UPPER('%main%')
AND UPPER(address) LIKE '%st%';`
I ended up keeping what I’m doing in the OP. It works for my purpose.