declare @aaa varchar(100)
set @aaa ='jd0233jd0356'
select *
from table
where charindex(abc,@aaa) < 0

解决方案 »

  1.   

    1、
    因为jd0030的所有字符在aaa字符串中都出现过。2、
    declare @aaa varchar(100)
    set @aaa='jd0233jd0356'
    select * from 表 where charindex(abc,@aaa)=0
      

  2.   

    declare @t table(abc varchar(100))
    insert @t 
    select 'jd0030' union all 
    select 'jd0179' union all  
    select 'jd0233' union all
    select 'jd0356' union all
    select 'jd0451' union all
    select 'jd0722'declare @aaa varchar(100)
    set @aaa ='jd0233jd0356'
    select *
    from @t
    where charindex(abc,@aaa) <= 0/*abc                                                                                                  
    -----------------------
    jd0030
    jd0179
    jd0451
    jd0722
    */
      

  3.   

    SELECT abc FROM xxx where CHARINDEX(abc, '" +  aaa + "') < = 0"