某天有个同事问我怎么在一个表中查找某字段值为null并把它替换为另一值。
开始我觉得用 select * from 表名 where 字段=null 应该可以的。
但结果是没有报错,但什么也没有显示出来。
后来又试:
select * from 表名 where len(字段)=0 结果仍是什么也没有显示。
无意中,用 select * from 表名 where 字段 is null 却对了。
看来好多知识是要多试才能知道的。呵呵。
同事询问如何在表中查找某字段值为NULL并替换为另一值。作者起初用'select * from 表名 where 字段=null'和'select * from 表名 where len(字段)=0'均未成功,最后用'select * from 表名 where 字段 is null'找到结果,强调知识需多尝试。
某天有个同事问我怎么在一个表中查找某字段值为null并把它替换为另一值。
开始我觉得用 select * from 表名 where 字段=null 应该可以的。
但结果是没有报错,但什么也没有显示出来。
后来又试:
select * from 表名 where len(字段)=0 结果仍是什么也没有显示。
无意中,用 select * from 表名 where 字段 is null 却对了。
看来好多知识是要多试才能知道的。呵呵。
2527
3276