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章 喜从天降' 是从查询分析器结果中拷贝出来的,为什么查不到呢?
查不到记录select * from dbo.book_chapter where bookName='佣兵天下' and [chapteTitle] like'第100章%喜从天降'
能查到记录chapteTitle是varchar类型
[chapteTitle]='第100章 喜从天降' 是从查询分析器结果中拷贝出来的,为什么查不到呢?
我用的是sql2005
where bookName='佣兵天下'
and [chapteTitle]=N'第100章 喜从天降' ??
where bookName='佣兵天下'
and [chapteTitle]=N'第100章 喜从天降' 这样也查不出来我想知道查为出来是因为什么原因,是我的sql的配置问题吗,还是第100章 喜从天降 不是空格还是其它字符
select * from dbo.book_chapter where bookName='佣兵天下'
and chapteTitle like '第100章__喜从天降'
这样能查出来,why
REPLACE([chapteTitle],' ','')='第100章喜从天降'
试试看?
要不然应该不是空格了
select * from dbo.book_chapter where bookName='佣兵天下'
and chapteTitle ='第100章 喜从天降'
*
from dbo.book_chapter
where bookName='佣兵天下'
and CONVERT(NVARCHAR(50),chapteTitle) =N'第100章 喜从天降'
这样试试看,要不然就用LIKE
bookName='佣兵天下' and chapteTitle like '第100章%喜从天降' 查到了它的 ASCII 为9,也就是tab,不是两个空格,还是两个tab,果然一查就对了