I have a table called SubjectRank that provides subject and it's ranking.
I have a string that can be in any format. It can be 'hello cat, how -are you lion?' or 'yes horse'. In short it can be received in any manner and i have no control on how user sends the string.
What I need to do is check if the string contains any words in the subject column. If yes I need to return that word.
In addition if the string contains more than one subject from the table than I must check the ranking and return the value with the highest ranking. (1 lowest) So if the string contains 'hello cat, how -are you lion?' the sp must return the word lion.
How can I achieve this?