-2
select  (Col_Name) 
where (Col_Name) not like '%abc%'
and (Col_Name) not like '%cap%'
and (Col_Name) not like '%tis%'
and (Col_Name) not like '%sat%'
and (col_Name) not like '%plk%'
4

1 回答 1

3

SQL Server 本身不支持正则表达式,尽管您可以安装 CLR 函数来使用它们。

实现这一目标的一种方法是

SELECT *
FROM   YourTable
WHERE  col_Name IS NOT NULL AND
           NOT EXISTS (SELECT *
                       FROM   (VALUES ('abc'),
                                      ('cap'),
                                      ('tis'),
                                      ('sat'),
                                      ('plk')) V(C)
                       WHERE  col_Name LIKE '%' + C + '%') 

虽然我不认为这是一种改进。

于 2013-06-03T16:09:40.730 回答