sql server - SQL Select string not immediately preceded nor succeeded by other letters -
imagine following data:
peter santos (sa) john doe - sa maria santos
i match strings containing letters sa, not if they're inside word.
in other words, when evaluating "peter santos (sa)", should fail on "santos" since it's succeeded other letters, succeed on (sa) since there no letters preceding or succeeding it.
"john doe - sa" should match sa entry there...
"maria santos" should not return since it's succeeded other characters.
how achievable using ms sql without using regex?
i believe query logic gives need without using regex:
select string_to_search<br/> ...<br/> <br/> string_to_search 'sa[^a-za-z]%'<br/> or string_to_search '%[^a-za-z]sa'<br/> or string_to_search '%[^a-za-z]sa[^a-za-z]%'<br/>
the 3 predicates in clause allow 'sa' appear @ beginning, middle, or end of string, neither preceded or followed letters.
Comments
Post a Comment