我调用邹健的分页的存储过程:
exec p_show 'select top 100 percent * ,convert(char(10),QT_ChargeDate,20) new_ChargeDate from QT_Charge_list where 1=1 and QT_ChargeDate>'2007-11-1' and QT_ChargeDate<'2007-11-30' ORDER BY new_ChargeDate DESC ',20,1但QT_ChargeDate>'2007-11-1'这段的单引号怎么起作用???

解决方案 »

  1.   

    字符串里的单引号要输入两次
    exec   p_show   '
    select   top   100   percent   *   ,
    convert(char(10),QT_ChargeDate,20)   new_ChargeDate   
    from   
    QT_Charge_list   
    where   
    1=1   and  
     QT_ChargeDate> ''2007-11-1''   and   QT_ChargeDate <''2007-11-30''   
     ORDER   BY   new_ChargeDate   DESC   '
     ,20,1 
      

  2.   


    ' 要使用''转义
    '是字符串要加''
    print ''''
      

  3.   


    exec   p_show   'select   top   100   percent   *   ,convert(char(10),QT_ChargeDate,20)   new_ChargeDate   from   QT_Charge_list   where   1=1   and   QT_ChargeDate> ''2007-11-1''   and   QT_ChargeDate <''2007-11-30''   ORDER   BY   new_ChargeDate   DESC   ',20,1 
      

  4.   


    没人提这个方法呢
    'QT_ChargeDate> '+char(39)+'2007-11-1'+char(39)
    char(39)就是'
      

  5.   

    declare @str1 varchar(20),
    @str2 varchar(20)
    set @Str2=char(39)+'中国人'+char(39)
    set @str1='我是' + char(39)+'中国人'+char(39)
    print @str1
    print @str2