大家谁知道 sqlserver里 字段值为 null 在sql 语句里 怎么表示啊

来源:百度知道 编辑:UC知道 时间:2024/06/28 00:08:40
比如: sql=" update SMT_yp set SMT_type=0 where SMT_type=null"
conn.execute (sql)
我测试了,就是不管用!郁闷!在线等!

等于NULL 写为 where SMT_type is null
不为NULL 写为 where SMT_type is not null
等于空时才用=号 where SMT_type = ''

sql=" update SMT_yp set SMT_type=0 where SMT_type is null"
回答者:cyrix123 - 举人 四级

你直接把默认值改成0,不就可以了?

sql=" update SMT_yp set SMT_type=0 where SMT_type is null"

sql=" update SMT_yp set SMT_type=0 where isnull(SMT_type)=true "