日期:2014-05-17  浏览次数:20915 次

如何查询和输入区分<NULL>和空值
因为导入sql   server,空的项都变成了 <null> ,而我要判断的某个值设置成空
我想把表中所有是 <null> 的都改成空值就是什么都没有。如何改?
另外在保存输入的时候,怎么写才能保存为 <null> 而不是空值,谢谢!

------解决方案--------------------
利用sql server 的ISNULL ( check_expression , replacement_value ) ,详细请查看帮助文件

------解决方案--------------------
取时直接用 where isnull(aa) or aa= " " 不就行了
------解决方案--------------------
把表中所有是 <null> 的都改成空值

update 表名 set 字段= ' ' where 字段 is null

入库的时候不要赋值,自动就是 null(当然,你设计表的时候不要对这个字段设置默认值)
------解决方案--------------------
update tab set field=null where field= " "

保存为 null
------解决方案--------------------
是字符串类型的吗?如果是,请用单引号:
update tab set field= ' ' where field is null