在近日的写Web程序时用到了Access的模糊查询,在Acces里写代码怎么也找不到记录,后来才起来原来Acess和SqlServer的模糊查询是有特别的
条件:查找表A 的Name字段中包括 "B" 的记当
在Access里的代码:
1
Select
*
from
a
where
name
like
'
*b*
'
Sql Server查询分析器的代码
Select
*
from
a
where
name
like
'
%b%
'
这时你会发现Access里可以找到相关的记录,但把'*'必成'%'就找不到了,原因是Access的模糊查询是'?','*'
和Sql server不一样
以上只是在数据库中的代码,如果要写在程序里可就不能用.'*'了,还是要用'%'
程序:

本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利
This posting is provided "AS IS" with no warranties, and confers no rights.
This posting is provided "AS IS" with no warranties, and confers no rights.