goback add

关于Sql Server的整形字段和空的查询

3285 点击·0 回帖
灯火互联
楼主

关于Sql Server的整形字段和空的查询

现象如下: 字段intType是整形的。
select * from Test where varcharType='test' and intType=''

可以查出 intType为0的记录。  www.atcpu.com  
update Test set dcr_times=''这时 Test的值为0。

关于 Oracle 和 SQLServer 的区别:

insert into table1(a,b) values(null,'');

在Oracle中插入记录的a列的值和b列的值都为空值(Null)

在SQLServer中插入记录的a列的值为空值(Null),b列的值为默认值,默认值对于char/varchar类型来讲为空字符串,对于数值类型来讲为0,对于日期或时间类型来讲为1900-01-01 :00:00:00


作者 refactor


喜欢0 评分0