日期:2014-05-18  浏览次数:20639 次

如何在 select 的 where 子句中使用正则表达式?
如何在 select 的 where 子句中使用正则表达式?
我用的是SQL SERVER 2000。 最好给个例子,谢谢!

------解决方案--------------------
正则表达式是什么意思?
------解决方案--------------------
正则表达式是什么意思?
------解决方案--------------------
you need to write your own UDF (user defined functions) for Regex using C#/VB.


------解决方案--------------------
And unfortunately SQL Server 2000 doesn't support CLR UDF at all, i.e., you cannot utilize those Regex functions defined in class System.Text.RegularExpressions
------解决方案--------------------
可以用 regexp 关键字来实现。
我想搜索 admin 表中 username 字段为数字的记录。则可以使用下面的 SQL 语句:
select * from articles where title regexp '[0-9].+';
------解决方案--------------------
SQLSERVER本身不象ORACLE可以支持正则表达式,只是支持简单的LIKE匹配
但SQL2005 CLR写个自定义函数实现,SQL2000是不支持CLR的

------解决方案--------------------
我的是SQL SERVER 2005, 我天天在用正则表达式.