Find all special characters in a column in SQL Server 2008

后端 未结 4 606
梦如初夏
梦如初夏 2020-12-24 08:31

I need to find the occurrence of all special characters in a column in SQL Server 2008. So, I don\'t care about A, B, C ... 8, 9, 0, but I do care

4条回答
  •  忘掉有多难
    2020-12-24 09:20

    The following transact SQL script works for all languages (international). The solution is not to check for alphanumeric but to check for not containing special characters.

    DECLARE @teststring nvarchar(max)
    SET @teststring = 'Test''Me'
    SELECT 'IS ALPHANUMERIC: ' + @teststring
    WHERE @teststring NOT LIKE '%[-!#%&+,./:;<=>@`{|}~"()*\\\_\^\?\[\]\'']%' {ESCAPE '\'}
    

提交回复
热议问题