SUM某个字段结果,如果为Null时则用0插入 怎么显示字符转化为number有误?
EG:
UPDATE BatchTicketDetail SET BatchTicketDetail_Waste = (Select Case Sum(BatchDetailBad_Qty) When 'null ' Then '0 ' else Sum(BatchDetailBad_Qty) end AS wQty From BatchDetailBad
Thanks!!!
------解决方案----------------------将 'null ' 改为null
UPDATE BatchTicketDetail SET BatchTicketDetail_Waste = (Select Case Sum(BatchDetailBad_Qty) When null Then '0 ' else Sum(BatchDetailBad_Qty) end AS wQty From BatchDetailBad
------解决方案--------------------自己解决..呵呵!就是有点疑问,会用case when 居然不会用ISNULL?没想到吧!