SQL Server 2008 query to find rows containing non-alphanumeric characters in a column

后端 未结 3 790
情深已故
情深已故 2020-12-14 06:00

I was actually asked this myself a few weeks ago, whereas I know exactly how to do this with a SP or UDF but I was wondering if there was a quick and easy way of doing this

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 06:36

    Sql server has very limited Regex support. You can use PATINDEX with something like this

    PATINDEX('%[a-zA-Z0-9]%',Col)
    

    Have a look at PATINDEX (Transact-SQL)

    and Pattern Matching in Search Conditions

提交回复
热议问题