Access判断字段为空

错误:sql="select * from itlogger where it=null"

  sql="select * from itlogger where it='' "   

  sql="select * from itlogger where len(it)=0"

  正确:sql="select * from itlogger where it is null"
转载请注明 :IT樵客

此条目发表在 程序设计 分类目录,贴了 标签。将固定链接加入收藏夹。

关于 logger

2010年网络规划设计师证书寻挂靠!

Access判断字段为空》有 1 条评论

  1. 用if 语句判断字段是否为空时,为什么用it=" "判断时,结论为错误的,而用it<>" "却能做出正确的判断呢?

  2. 我的理解,真正空为null,而null<>"",所以判断null=""时错误,null<>""时正确!

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>