select * from dbo.book_chapter where bookName='佣兵天下' and [chapteTitle]='第100章  喜从天降'
查不到记录select * from dbo.book_chapter where bookName='佣兵天下' and [chapteTitle] like'第100章%喜从天降'
能查到记录chapteTitle是varchar类型
[chapteTitle]='第100章  喜从天降' 是从查询分析器结果中拷贝出来的,为什么查不到呢?

解决方案 »

  1.   

    and chapteTitle like '第100章_喜从天降'能找到记录吗?
      

  2.   

    and chapteTitle like '第100章_喜从天降' 查不出来
    我用的是sql2005
      

  3.   

     like'%第100章%喜从天降%' 
      

  4.   

    select * from dbo.book_chapter 
    where bookName='佣兵天下'
     and [chapteTitle]=N'第100章  喜从天降' ??
      

  5.   

    select * from dbo.book_chapter 
    where bookName='佣兵天下'
     and [chapteTitle]=N'第100章  喜从天降' 这样也查不出来我想知道查为出来是因为什么原因,是我的sql的配置问题吗,还是第100章  喜从天降 不是空格还是其它字符
      

  6.   


    select * from dbo.book_chapter where bookName='佣兵天下'
    and chapteTitle like '第100章__喜从天降'
    这样能查出来,why
      

  7.   


    REPLACE([chapteTitle],' ','')='第100章喜从天降' 
    试试看?
    要不然应该不是空格了
      

  8.   

    傻眼了,不知道它是tab,还是个什么东西,用等号查的时间就是不出来
    select * from dbo.book_chapter where bookName='佣兵天下'
    and chapteTitle ='第100章  喜从天降' 
      

  9.   

    select 

    from dbo.book_chapter 
    where bookName='佣兵天下' 
    and CONVERT(NVARCHAR(50),chapteTitle) =N'第100章  喜从天降'
    这样试试看,要不然就用LIKE
      

  10.   

    可能是全角空格,或是其它特殊字符,建议楼主将字段值改为NVARCHAR ,插入值时加N''
      

  11.   

    select ASCII(substring(chapteTitle,7,1)) from  book_chapter where
    bookName='佣兵天下' and chapteTitle like '第100章%喜从天降' 查到了它的 ASCII 为9,也就是tab,不是两个空格,还是两个tab,果然一查就对了