Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SQL Server正则表达式-方括号中字符的分组_Sql_Sql Server_Regex_Sql Server 2012 - Fatal编程技术网

SQL Server正则表达式-方括号中字符的分组

SQL Server正则表达式-方括号中字符的分组,sql,sql-server,regex,sql-server-2012,Sql,Sql Server,Regex,Sql Server 2012,我正在SQL Server数据库的表中搜索字符串,为此我创建了一个正则表达式,因为我需要使用不同的组合进行搜索 select * from table where name like '%'+Sqlstring+'%' 例:-> 例如Sqlstring=“[sam12R]India”, 在这里,我不想把所有的角色都单独对待(有些角色我想分组,有些角色也单独对待) 所以我的搜索字符串如下 samIndia, 1India, 2India, RIndia, 这是什么味道的SQL?MySQL?Pr

我正在SQL Server数据库的表中搜索字符串,为此我创建了一个正则表达式,因为我需要使用不同的组合进行搜索

select * from table where name like '%'+Sqlstring+'%'
例:->

例如
Sqlstring=“[sam12R]India”,

在这里,我不想把所有的角色都单独对待(有些角色我想分组,有些角色也单独对待)

所以我的搜索字符串如下

samIndia,
1India,
2India,
RIndia,

这是什么味道的SQL?MySQL?ProsgreSQL?MSSQL2005?2008? 神谕SQLite?您不能在SQL Server中查询这样的数据。只有在启用CLR后,正则表达式才能得到最充分的使用。根据您的具体要求,可以使用Like和一些逻辑运算符来实现: