34,590
社区成员
发帖
与我相关
我的任务
分享
case when B=0 then 0 else A/B end
set ansi_warnings off
set arithabort off
--设置这两项就可以了
create table tab(id int,id2 int)
insert tab
select 1,2 union
select 3,9 union
select 5,0
select id,id2,case id2 when 0 then 0 else cast(id as decimal)/id2 end
from tab
drop table tab
case when B=0 then 0 else A/B end
--设置会话选项
set ansi_warnings off
set arithabort off
select isnull(5/0,0)