模式匹配符的问题,为何'_'和'%'查询到的结果一样?想不通(sqlserver 7.0)

我用:
select check_id from check_is where check_id like
'01______'
查询到的结果:
01
0101
0102
010101
01010101
01010102
010102
0102
0103

我只要查询:
01010101
01010102

可为何都显示出来呢?要是这样的话那不是和'%'查到的结果一样了吗?
那‘_’还能不能匹配单个字符?
---------------------------------------------------------------

自导自演啊~~~

---------------------------------------------------------------

你的分也要给出来啊,放在那里没用
---------------------------------------------------------------

没错丫,_(下划线)就是代表 任何单个字符。
---------------------------------------------------------------

是这样解决的吗?
select check_id from check_is where check_id like
'01______' and len(check_id ) = 8

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus