Sqlserver系列(二) 模糊查询 like
通配符
% 匹配零个或多个字符
_ 匹配单个字符
[] 指定范围 ([a-f]) 或集合 ([abcdef]) 中的任何单个字符。
[^] 不属于指定范围 ([a-f]) 或集合 ([abcdef]) 的任何单个字符。
转义符 []
示例
'a[a-f,^h-k]c' 匹配 a,c a^c aac abc acc adc aec afc ahc aic ajc akc
'a[a-f]c' 匹配 aac abc acc adc aec afc
'a[^a-f]c' 匹配 a[中间非a-f]c
'a[a-b,c-d]c' 匹配 a,c aac abc acc adc
'a[c' 匹配 ac
'a]c' 匹配 a]c
'a[[]c' 匹配 a[c
测试代码
- select *
- from(
- select 'aac' name
- union
- select 'abc'
- union
- select 'acc'
- union
- select 'adc'
- union
- select 'aec'
- union
- select 'afc'
- union
- select 'agc'
- union
- select 'ahc'
- union
- select 'aic'
- union
- select 'ajc'
- union
- select 'akc'
- union
- select 'alc'
- union
- select 'amc'
- union
- select 'anc'
- union
- select 'aoc'
- union
- select 'apc'
- union
- select 'aqc'
- union
- select 'arc'
- union
- select 'asc'
- union
- select 'atc'
- union
- select 'auc'
- union
- select 'avc'
- union
- select 'awc'
- union
- select 'axc'
- union
- select 'ayc'
- union
- select 'azc'
- union
- select 'a1c'
- union
- select 'a2c'
- union
- select 'a3c'
- union
- select 'a4c'
- union
- select 'a5c'
- union
- select 'a6c'
- union
- select 'a7c'
- union
- select 'a8c'
- union
- select 'a9c'
- union
- select 'a0c'
- union
- select 'a-c'
- union
- select 'a_c'
- union
- select 'a+c'
- union
- select 'a=c'
- union
- select 'a[c'
- union
- select 'a]c'
- union
- select 'a{c'
- union
- select 'a}c'
- union
- select 'a|c'
- union
- select 'a\c'
- union
- select 'a;c'
- union
- select 'a%c'
- union
- select 'a,c'
- union
- select 'a^c'
- union
- select 'ac'
- )container
- where name like 'a[[]c'
测试代码
Sqlserver系列(二) 模糊查询 like的更多相关文章
- 【SqlServer系列】子查询
1 概述 1.1 已发布[SqlServer系列]文章 [SqlServer系列]SQLSERVER安装教程 [SqlServer系列]数据库三大范式 [SqlServer系列]表单查询 [Sq ...
- LINQ to Sql系列二 简单查询和联接查询
这一篇文章主要总结LINQ to sql的简单查询(单表查询)和联接查询(多表查询) 单表查询 需求是我们要输出TClass表中的结果.使用了from-in-select语句,代码如下: public ...
- 【SqlServer系列】表单查询
1 概述 如下几个问题,如果你能解决,请继续往下看,若不能解决,请先复习SQL基础知识,再来阅读本篇文章.本篇文章深度中等左右. Q1:表StudentScores如下,用一条SQL语句查询出每门 ...
- 【SqlServer系列】表连接
1 概述 1.1 已发布[SqlServer系列]文章 [SqlServer系列]MYSQL安装教程 [SqlServer系列]数据库三大范式 [SqlServer系列]表单查询 1.2 本篇 ...
- 【SqlServer系列】开启Sqlserver远程访问
1 概述 已发布[SqlServer系列]文章如下: [SqlServer系列]SQLSERVER安装教程 [SqlServer系列]数据库三大范式 [SqlServer系列]表单查询 [SqlS ...
- 【SqlServer系列】集合运算
1 概述 已发布[SqlServer系列]文章如下: [SqlServer系列]SQLSERVER安装教程 [SqlServer系列]数据库三大范式 [SqlServer系列]表单查询 [SqlS ...
- 【SqlServer系列】远程访问
1 概述 已发布[SqlServer系列]文章如下: [SqlServer系列]SQLSERVER安装教程 [SqlServer系列]数据库三大范式 [SqlServer系列]表单查询 [SqlS ...
- MyBatis的手动映射与模糊查询
一.手动映射 当实体类属性与数据库字段名不同时,无法自动映射,导致查询出空值,这时候可以使用手动映射 在select节点添加resultMap属性与resultMap节点建立关系
- sqlserver 分页模糊查询
积少成多 ---- 仅以此致敬和我一样在慢慢前进的人儿 问题: 在sqlserver 进行模糊查询,出现问题 最初使用“concat”,进行拼串操作,如下所示: <select id = ...
- ASP.NET MVC+EF框架+EasyUI实现权限管理系列(20)-多条件模糊查询和回收站还原的实现
原文:ASP.NET MVC+EF框架+EasyUI实现权限管理系列(20)-多条件模糊查询和回收站还原的实现 ASP.NET MVC+EF框架+EasyUI实现权限管系列 (开篇) (1):框架 ...
随机推荐
- js keycode 列表
keycode 8 = BackSpace BackSpace keycode 9 = Tab Tab keycode 12 = Clear keycode 13 = Enter ...
- Android----------eclipse常用快捷键
类级操作:--------------------一个去包,一个导包------------------------------------ Ctrl+shift+O (不是零) 清除没用引用 ctr ...
- CppCon - Modern Template Metaprogramming 杂记
2014年底才看到github和channel9上有CppCon2014的视频和资料,顿时激动不已.最近小生也一直在研习CppCon2014中令人兴奋的内容.这篇鄙文就是小生学习了<Modern ...
- 初学linux命令
linux系统的精髓在于它的命令行 早就听说要学习linux系统,就要学习它的命令行(Command Line Interface).说来惭愧,已经使用了linuxmint快两个月了,虽然能够使用一些 ...
- javascript事件捕获与冒泡
对“捕获”和“冒泡”这两个概念,我想我们对冒泡更熟悉一些,因为在我们使用的所有浏览器中,都支持事件冒泡,即事件由子元素向祖先元素传播的,就 像气泡从水底向水面上浮一样.而在像firefox,chrom ...
- 循环与range
Python的循环有两种,一种是for...in循环,依次把list或tuple中的每个元素迭代出来,看例子: names = ['Michael', 'Bob', 'Tracy'] for name ...
- shell脚本练习
写一个脚本:1.设定变量FILE的值为/etc/passwd2.依次向/etc/passwd中的每个用户问好,并显示对方的shell,形如: Hello, root, your shell: /bin ...
- 清空DNS缓存
昨天写了个Python的脚本,功能就是爬取一个网页上的Google ip地址再写入到本机的hosts里面去. 但是写完并且运行完成之后发现上不了Google.于是想到了是不是要清空一下DNS的缓存.不 ...
- 流媒体(RTMP,RTSP,HLS)
流媒体(RTMP,RTSP,HLS) 前言 最近项目需要流媒体的播放,后端一共提供了 三种流数据(RTSP,RTMP,HLS),在不同的场景可能会使用到不同方式播放,就需要做到适配, 支持所有的流数据 ...
- 锁机制与原子操作 <第四篇>
一.线程同步中的一些概念 1.1临界区(共享区)的概念 在多线程的环境中,可能需要共同使用一些公共资源,这些资源可能是变量,方法逻辑段等等,这些被多个线程共用的区域统称为临界区(共享区),临界区的资源 ...