字符串分拆 select * from 表where charindex('54',[错误编号])>0 and charindex('54',[错误编号])%2=0 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from 表 where 错误编号 like '%54%' 疏忽了,应该是:select * from 表where charindex('54',[错误编号])>0 and charindex('54',[错误编号])%2=1 我的有问题,要vivianfdlpw()兄的才是正确的select * from 表 where charindex('54',[错误编号])%2>0 and charindex('54',错误编号)>0 declare @tb table( id int, [错误编号] varchar(10))insert @tbselect 1,'12546321' unionselect 2,'54' unionselect 3,'154231' unionselect 4,'015431' unionselect 5,'12253154' unionselect 6,'30545412' --查询select * from @tbwhere charindex('54',[错误编号])>0 and charindex('54',[错误编号])%2=1--结果/*id 错误编号 ----------- ---------- 1 125463212 544 0154315 122531546 30545412(所影响的行数为 5 行)*/ vivianfdlpw() 试试'154254',可能查不出吧,这个应该符合条件的 谢谢各位拉,CSDN真是热心人真多啊! select * from tbnamewhere substring(a,1,2)='54'orsubstring(a,3,2)='54'orsubstring(a,5,2)='54'orsubstring(a,7,2)='54'orsubstring(a,9,2)='54' waterfirer那那个方法可行,感谢vivianfdlpw提供的帮助 求一条同一字段满足多个条件的语句 请教一个问题 求一句sql。。sql2005的 求助 几个查询语句 除数问题 请问下面的SQL语句错误在那里? 求一个关于文章TAG的SQL算法 请问有人查询过ntext 类型的字段内容吗,该怎么查出其诶容呢?? 这句错误信息是什么意思啊? 好难受,装了好几遍SQLSEVER,为什么还是这个样子呀。。。 怎样验证一个SQL语句是否有效? 有关于DTS数据导入的问题,我有两张表,需要将A表的一列数据导入B表相同的字段中去!
where charindex('54',[错误编号])>0
and
charindex('54',[错误编号])%2=1
(
id int,
[错误编号] varchar(10)
)
insert @tb
select 1,'12546321' union
select 2,'54' union
select 3,'154231' union
select 4,'015431' union
select 5,'12253154' union
select 6,'30545412' --查询
select * from @tb
where charindex('54',[错误编号])>0
and
charindex('54',[错误编号])%2=1--结果
/*
id 错误编号
----------- ----------
1 12546321
2 54
4 015431
5 12253154
6 30545412(所影响的行数为 5 行)
*/
where
substring(a,1,2)='54'
or
substring(a,3,2)='54'
or
substring(a,5,2)='54'
or
substring(a,7,2)='54'
or
substring(a,9,2)='54'