读书人

?困了?解决办法

发布时间: 2012-05-03 14:06:56 作者: rapoo

?困了?
1.

SQL code
 select len(fmark),fmark from productholeboxdt where prodno = 'S110800508' and boxno = '02'
查果:
5
2.
SQL code
select len(fmark),* from productholeboxdt where prodno = 'S110800508' and boxno = '02'  ltrim(rtrim(fmark)) = N'' 

果为空,为什么呀?同一个数据库

[解决办法]
因为多了一个空格,我是被标题吸引起来的 同样打瞌睡
[解决办法]
' %'
里面有空格啊

sql模糊查询 不去空格啊!
[解决办法]
SQL code
select len(fmark),* from productholeboxdt where prodno = 'S110800508' and boxno = '02'and ltrim(rtrim(fmark)) like ' %'  --这地方有个空格,空格也是要占位的。 数据里面没有带  的数据 

读书人网 >SQL Server

热点推荐