select * from 表
where charindex('54',[错误编号])>0
      and
      charindex('54',[错误编号])%2=0

解决方案 »

  1.   

    select * from 表 where 错误编号 like '%54%'
      

  2.   

    疏忽了,应该是:select * from 表
    where charindex('54',[错误编号])>0
          and
          charindex('54',[错误编号])%2=1
      

  3.   

    我的有问题,要vivianfdlpw()兄的才是正确的select * from 表 where charindex('54',[错误编号])%2>0 and charindex('54',错误编号)>0
      

  4.   

    declare @tb table
    (
      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 行)
    */
      

  5.   

    vivianfdlpw() 试试'154254',可能查不出吧,这个应该符合条件的
      

  6.   

    谢谢各位拉,CSDN真是热心人真多啊!
      

  7.   

    select * from tbname
    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'
      

  8.   

    waterfirer那那个方法可行,感谢vivianfdlpw提供的帮助