I want to create a function/tsql to get strings from the 1st table/data and compare and convert to the value of a second table if the strings match what is on table 2.
Business example.
When a cashier mistakenly encoded ABC1231 as company name instead of ABC the report will have an issue showing ABC1231 instead of ABC. We need to correct this by matching it against a master list of company names in another table.
The query logic Im trying to apply here is to match how many similar strings are in table 1 data to master list data in table 2. Then if the process saw that the strings from table 1 has a match or has the highest similar string it will output what data in table 2. This should be also case sensitive and allows int and special character. See example below.
Example:
Table 1 contains ->
A121B312C33,AB12312C,ABCAB-C,ABC223,AsBCD21,D23EF,D2E2F2,DEF
Table 2 contains ->
ABC,DEF
Output should be:
ABC,ABC,ABC,ABC,ABC,DEF,DEF,DEF
It is not only capital letters. It should match what is on the 2nd table whether lower case or upper case with special characters or with integer as well.