返回字段仅包含非字母数字字符的 sql 行 [英] Return sql rows where field contains ONLY non-alphanumeric characters

查看:40
本文介绍了返回字段仅包含非字母数字字符的 sql 行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找出我的 sql server 表中特定字段中有多少行,只包含非字母数字字符.

I need to find out how many rows in a particular field in my sql server table, contain ONLY non-alphanumeric characters.

我认为这是一个我需要的正则表达式 [^a-zA-Z0-9] 但我不确定如果没有有效的字母数字字符,我需要返回行的确切语法

I'm thinking it's a regular expression that I need along the lines of [^a-zA-Z0-9] but Im not sure of the exact syntax I need to return the rows if there are no valid alphanumeric chars in there.

推荐答案

SQL Server 没有正则表达式.它使用不同的 LIKE 模式匹配语法.

SQL Server doesn't have regular expressions. It uses the LIKE pattern matching syntax which isn't the same.

碰巧,你很接近.只需要前导+尾随通配符并移动 NOT

As it happens, you are close. Just need leading+trailing wildcards and move the NOT

 WHERE whatever NOT LIKE '%[a-z0-9]%'

这篇关于返回字段仅包含非字母数字字符的 sql 行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆