字段sj为datetime类型
现在要显示成:如果sj字段的值为Null,则显示"未接收",否则显示sj的值
case sj is null or sj='' when true then '未接收' when false then cast(sj as varchar(20)) end
这样为什么不对呢?
现在要显示成:如果sj字段的值为Null,则显示"未接收",否则显示sj的值
case sj is null or sj='' when true then '未接收' when false then cast(sj as varchar(20)) end
这样为什么不对呢?
else cast(sj as varchar(20)) end
declare @tb table(sj datetime)insert @tb select null union all select getdate()select case when sj is null then '未接收' else convert(varchar(19),sj,120) end 状态 from @tb既然SJ是为DATETIME类型就不需要or SJ=''