I am using wildcards in a join statement to find when a specific phrase is contained in a text field. Originally, I tried something like:
[Text Field] LIKE '%[^0-9A-Z]' + [Phrase] + '[^0-9A-Z]%'
However, this only gives me results that contain the phrase inside of the text field surrounded by spaces or special characters. Instead I need it to be when the phrase is surrounded by a leading or trailing space, or if the phrase is at the beginning or end of text field. Does anyone have any idea on how to accomplish this? I have searched around to no avail.
Presumably, you are using SQL Server. Just add spaces to the beginning and end of the column:
' ' + [Text Field] + ' ' LIKE '%[^0-9A-Z]' + [Phrase] + '[^0-9A-Z]%'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.