Skip to content
Advertisement

Pattern matching techniques in SQL to correctly match a sting to a keyword but not getting the right results

I have a table (dbo.Library) where I have build a library of keywords that are associated with different titles and persona in a company. See below:

Let’s say I have another table as below:

Now I want to JOIN the dbo.library to the dbo.TargetTable on title using pattern matching to update the Persona column accordingly:

This matches on every letter in the keyword hence I get titles that have nothing to the keyword matched to a persona. While what I actually want is:

Do you know how can I solve this? Is there even a way to do exact matching of the keyword string while using [ ]?

Advertisement

Answer

How about simply replacing embedded spaces in the keyword with wildcard character '%'?

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement