jeudi 8 novembre 2018

SQL query to search for patterns against a specific string

I am currently dealing with a table containing a list of hundreds of part number patterns for discount purposes. For example:

1) [FR]08-[01237]0[67]4E-%
2) _10-[01]064[CD]-____
3) F12-[0123]0[67]4C-%

I have a string search criteria: F10-1064C-02TY and I am trying to find out which pattern(s) matches that particular string. For this example my query would return the second pattern. The objective is to find the correct part discount based on the matched pattern(s).

What is the best approach in handling this type of problem? Is there a simple and elegant approach or does this involve some complex TSQL procedure?

Aucun commentaire:

Enregistrer un commentaire