搜索特殊字符 - SQL SERVER 2008

时间:2017-08-02 18:17:54

标签: sql-server-2008 pattern-matching special-characters

我收到有关用于模式匹配的以下语法的错误:

'%[0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][.-][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][.-][0-9][0-9][0-9][0-9][0-9][0-9]'

SQL SERVER 2008不喜欢[.-]部分。

仅查找句点或连字符作为段分隔符时的正确语法是什么?

由于

1 个答案:

答案 0 :(得分:0)

你可能只需要逃脱连字符......

WHERE SomeColumn LIKE '%[0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][.!-][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][0-9,A-Z][.!-][0-9][0-9][0-9][0-9][0-9][0-9]' ESCAPE '!'