Home > Database > Mysql Tutorial > body text

(注意)如何判断数据库字段 不为空 不为null 不为" "

WBOY
Release: 2016-06-07 14:59:19
Original
1986 people have browsed it

现在想把所有部门为空的记录更新为'制造部',其语为update userlist set dept='制造部' where dept='' 但是提示进行了0条记录,再查看记录也没有被更新,不知道在sql中,空记录用什么表示。我用 字段名=null 不行哦!!! ==================================

     现在想把所有部门为空的记录更新为'制造部',其语为update userlist set dept='制造部' where dept='' 但是提示进行了0条记录,再查看记录也没有被更新,不知道在sql中,空记录用什么表示。我用 字段名=null 不行哦!!!

========================================================================================
where dept is null

========================================================================================
一般是在程序里判断,
NULL 在MSSQL里边也是一种特殊的值,只能用IS NULL或者IS NOT NULL来判断,
不为空简单,''就可以

 
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!