数据库表一字段:iszongjian,类型为int,允许为空,
现在这一表有5000多行数据,iszongjian的值有两种,一种是1,一种是NULL,
现在我要找出iszongjian不为1的所有列,也可以说iszongjian为Null值的所有列。
但是现在用了很多sql语句都找不出结果。
求高手指教。
附用过的sql语句
select * from BidComRelation where iszongjian=null
select * from BidComRelation where iszongjian!=1
select * from BidComRelation where convert(varchar(50), iszongjian)=''
select * from BidComRelation where convert(varchar(50), iszongjian)='NULL'
都不能得到任何数据啊,求指教。
select * from BidComRelation where iszongjian!=1
这个查不出吗?
select * from BidComRelation where iszongjian is null
select * from BidComRelation where iszongjian != 1
select * from BidComRelation where iszongjian <> 1
select * from BidComRelation where iszongjian is null
select * from BidComRelation where iszongjian!=1]-->
select * from BidComRelation where iszongjian<>1
楼主该结贴吧?
http://topic.csdn.net/u/20100826/18/7b81012a-b5c4-48b1-b5d1-40a92f3e0388.html
2> select * from BidComRelation where iszongjian <>1;
3> select * from BidComRelation where iszongjian not in(1);
以上三种都正确。
不过select * from BidComRelation where iszongjian=null;
也没有错你这是数据库选项 ANSI_NULLS 的设置问题,如下所示:
set ANSI_NULLS off
select * from BidComRelation where iszongjian=null;
这就有返回值了。因为在默认状态下ANSI_NULLS 是置为 on 的。