select * from Table1 where Filed1 like '%ABCDEFG%' 
----------------------------------------^-------^---
的意思是查找所有Field1字段中包含字符串'ABCDEFG'的记录
你要的.
select * from Table1 where 'ABCDEFG' like Filed1 +'%'

解决方案 »

  1.   

    select * from Table1 where Filed1 like '%ABCDEFG%' 
    ----------------------------------------^-------^---
    的意思是查找所有Field1字段中包含字符串'ABCDEFG'的记录
    你要的.
    select * from Table1 where charindex(filed1,'ABCDEFG')>0
    OR
    select * from Table1 where 'ABCDEFG' like Filed1 +'%'
      

  2.   

    select * from Table1 where Filed1 like '%ABCDEFG%' or 'ABCDEFG' like '%'+Filed1+'%'
      

  3.   

    select * from Table1 where charindex(filed1,'ABCDEFG')>0
    OR
    select * from Table1 where 'ABCDEFG' like '%' + Filed1 +'%'
      

  4.   

    select * from Table1 where Filed1 like '%ABCDEFG%' 
    %用来匹配
    楼上所写的检索子集的SQL语句行吗?
    关注中...
      

  5.   

    select * from Table1 where Filed1 like '%ABCDEFG%'