我正在使用dbvisualizer SQL语句,并且我试图在字段中搜索它是否包含字母和数字,或者只是一个或另一个。这有可能以简单的方式进行吗?目前我只是单独检查每个人:
case when card_address like '%0%'
or card_address like '%1%'
or card_address like '%2%'
or card_address like '%3%'
or card_address like '%4%'
or card_address like '%5%'
or card_address like '%6%'
or card_address like '%7%'
or card_address like '%8%'
or card_address like '%9%'
then 'True' else 'False' end as numbers_in_address
答案 0 :(得分:0)
在MYSQL中,您可以使用正则表达式运算符
ContactItem
在SQLSERVER中,您可以在LIKE中使用模式
case
when card_address REGEXP '[0-9]' then 'True'
else 'False'
end as numbers_in_address