本帖最后由 lzg2001 于 2010-10-11 15:51:36 编辑

解决方案 »

  1.   

    没有测试:try~
    SELECT * FROM TB t
    WHERE CHARINDEX('4',SUBSTRING(字段A,2,LEN(字段A)-1)))>0
      

  2.   

    select * from tb where ','+字段A+',' like '%,4,%'
      

  3.   

    WHERE CHARINDEX(',4,',','+字段A+',')))>0
      

  4.   

    select * from tb where charindex(',4,',','+a+',')>0
      

  5.   


    select * from tb where charindex(',4,',','+字段A+',')>0
      

  6.   

    ---测试数据
    if object_id('tb') is not null
    drop table tb
    create table tb (id int,字段A varchar(100))
    insert into tb
    select 1,'1,2,11,4,8,19'   union all  
    select  2,'1,2,3,4'        union all
    select  3,'4,5,7,8'        union all
    select  4,'4'              union all
    select  5,'44,45,46'       union all
    select  6,'1,2,11,41,8,19,64'--查询
    select * from tb where ','+字段A+',' like '%,4,%'
    --结果
    /*
    id          字段A
    --- ---------------
    1 1,2,11,4,8,19
    2 1,2,3,4
    3 4,5,7,8
    4 4
    */
      

  7.   

    ---测试数据
    if object_id('tb') is not null
    drop table tb
    create table tb (id int,字段A varchar(100))
    insert into tb
    select 1,'1,2,11,4,8,19'   union all  
    select  2,'1,2,3,4'        union all
    select  3,'4,5,7,8'        union all
    select  4,'4'              union all
    select  5,'44,45,46'       union all
    select  6,'1,2,11,41,8,19,64'--查询
    select * from tb where ','+字段A+',' like '%,4,%'
    --结果
    /*
    id          字段A
    --- ---------------
    1 1,2,11,4,8,19
    2 1,2,3,4
    3 4,5,7,8
    4 4
    */
    --删除测试表
    drop table tb
      

  8.   


    select * from tb where charindex(',4,',','+a+',')>0
      

  9.   

    Select * from 表名
    Where [字段A] like ‘%4%’ and [字段A ] not like ‘%4%4%’
      

  10.   


    这位仁号,为什么我测试,只能得出
    1    1,2,11,4,8,19
    3    4,5,7,8你却能得出项4adm
      

  11.   

    还没解决啊?
    13#的没有问题。
    你先把他的代码全部copy到你的查询分析器,看看结果。
    我这边测试是正确的。
      

  12.   

    此查询条件:like '%,4,%' 意思是不是,可以出现一次或多次?