想用isnull函数,但是select出来的不是null值 select col1 from tbl1 where 1=2故意给个假条件,想查出一空行来,怎样才能使col1为null值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 where 1=2这个条件恒不成立,所以取不到行,自然得不到结果集中某列为null的结果.直接 SELECT NULL 即可. select col = case when getdate() > getdate() - 1 then 'null' end/*col----null(1 行受影响)*/ select null col/*col-----------NULL(1 行受影响)*/ select top 1 null from @tb select top 1 null as col1 from tbl1 where 1=1 带from 的时候,结果集中没有符合调节的记录是不会出数据的 select * from table where id is null select col1 from tbl1 where col1 is null select col1=isnull(null,'')--测试isnull--------select col1 from tbl1 where col1 is null--加上条件 select null as col from tabl1select (case when ‘条件’ then ‘值’ else null end) as col from tabl1 declare @tb table (id int)insert into @tb select 1insert into @tb select 2insert into @tb select 3select top 1 id=null from @tb /*idNULL*/ select isnull(name,'null')from table 存储过程传代单引号参数 在线等,马上给分, 表的格式转换问题 ER图需求分析,数据字典分析, 一个简单的关于Select语句的问题! SQL数据更新问题。 sqlsever2000用户问题 EJB3.0的persistence.xml配置文件怎么写 跪求一个SQL统计的问题 该语句如何写? NTEXT类型最多多少个字符????? 为什么改列的默认值老是不成功?该怎么改 还是没有解决,再问
这个条件恒不成立,所以取不到行,自然得不到结果集中某列为null的结果.直接 SELECT NULL 即可.
col
----
null(1 行受影响)
*/
col
-----------
NULL(1 行受影响)
*/
--------
select col1 from tbl1 where col1 is null--加上条件
select (case when ‘条件’ then ‘值’ else null end) as col from tabl1
insert into @tb select 1
insert into @tb select 2
insert into @tb select 3select top 1 id=null from @tb
/*
id
NULL
*/
from table