我当前正在使用sql server 2014
我有一个可能包含以下值的sql列
user_email
--------------------------------------------
[email protected]
[email protected]
[email protected];[email protected]
我需要选择列并构建where子句
所以where user_email like '%[email protected]%'
将选择第三行,但是如果我要执行user_email like '%[email protected]%'
,它将不会选择第三行。
希望这有意义吗?
我似乎找不到解决方法。
在某些情况下,改善数据结构的成本的确高于解决方法的好处。
请小心,通过使用变通办法,您会产生技术债务:-将来更容易出错[]
为了快速获胜,只需使用要使用的分隔符强制将要比较的字符串开始和结束...
';' + user_email + ';' LIKE '%;' + '[email protected]' + ';%'