select  * from export where 品牌 is not null and 文章标题 like '%还要忍多久?丰田的'刹车'与'回归'%'
这句查询语句转义怎么写呀,请大家帮下忙,谢了

解决方案 »

  1.   

    select * from export where 品牌 is not null
     and 文章标题 like '%还要忍多久?丰田的''刹车''与''回归''%'
      

  2.   

    select * from export where 品牌 is not null and 文章标题 like '%还要忍多久?丰田的''刹车''与''回归''%'
      

  3.   

    create table #(code varchar(20),value int)
    declare @sql varchar(200)
    set @sql='insert into # select ''AAA'',10' 
    -- AAA之前的一对单引号与之后的一对单引号分别代表一个单引号print @sql  --查看这个字符串的实际内容
    /*
    insert into # select 'AAA',10
    */exec(@sql)
    select * from #
    /*
    code                 value       
    -------------------- ----------- 
    AAA                  10
    */--如果需要insert一个值为'A''AA'的字符串,如下:
    set @sql='insert into # select ''A''''AA'',10'  
    --两层嵌套的字符串内部,一个单引号需要经过两次转义,于是变成了4个单引号print @sql  --查看这个字符串的实际内容
    /*
    insert into # select 'A''AA',10
    */exec(@sql)select * from #
    /*
    code                 value       
    -------------------- ----------- 
    AAA                  10
    A'AA                 10
    */
    drop table #
      

  4.   

    select * from export where 品牌 is not null and 文章标题 like "%还要忍多久?丰田的'刹车'与'回归'%"