请问类似 WHERE FullName LIKE '[王李张]小军' 这样的条件从句,可以从姓名列中查出叫“王小军”、“李小军”或“张小军”的记录吗?
解决方案 »
- case when then 子查询
- N的问题
- 时间一到自动更新
- 求一复杂的SQL语句
- top 6是找前1—6的,怎么找3-6的?
- fredrickhu 请, 既然您要平衡,分析一下sql2000如何面对未来的sql2008,需要学习哪些东西
- 这个语句该怎么写?看起来这么简单就是不会写???
- 急!!请问:我现有sql server 6.5的数据库的.dat 文件,能否将其恢复到sql server 2000中(立即给分)
- backup database时,如果希望生成的备份文件为多个,每个都不大于一张光盘,怎么办?
- 這問題相信大家一定遇到:用“between and ”如何包括所有中文的內容
- 用同表中的某些记录更新其他记录
- 关于模糊查询
and '李小军' LIKE '[王李张]小军'
and '张小军' LIKE '[王李张]小军'
select 'ok'
else
select 'not ok'
create table #t
(fullname varchar(20))
insert into #t select '王小军'
insert into #t select '李小军'
insert into #t select '张小军'
select * from #t where fullname like '[王李张]小军'
/*
王小军
李小军
张小军
*/
declare @tb table (fullname nvarchar(20))
insert into @tb
select '张小军' union all
select '李小军' union all
select '王小军' union all
select 'AAAA' union all
select '张小'select * from @tb where fullname like '_小军'
/*
fullname
--------------------
张小军
李小军
王小军
*/
insert into @tb
select '张小军' union all
select '李小军' union all
select '王小军' union all
select 'AAAA' union all
select '张小'select * from @tb where fullname like '[王李张]小军' /*
fullname
--------------------
张小军
李小军
王小军
*/
SQL 2005
A
N
Z
J