From: Joriveek on
When I specify a formula between Computed Column Specification, I have two
zero values, getting Divide by Zero error, any idea how can I avoid this? I
still want SQL Server to display Zero if it is 0/0, is this possible in SQL
Server database?

Thanks
J.


From: SQL on
use case, here is an example

create table #test (value1 numeric (12,2),value2 numeric (12,2))
insert into #test
select 1,0 union all
select 1,0 union all
select 5,3 union all
select 4,2
select case value2 when 0 then 0 else value1/value2 end as SomeValue
from #test

http://sqlservercode.blogspot.com/

From: yangyang on
IF like this:
Update a
Set X=column b/column c
where Column c<>0

Update a
Set X=0
where Column c=0

any help to you?

From: MC on
Or perhaps something like:

Update a
Set X= case when columnc=0 then 0 else column b/column c end




MC

"yangyang" <loveflying000(a)gmail.com> wrote in message
news:1141834929.055768.75450(a)v46g2000cwv.googlegroups.com...
> IF like this:
> Update a
> Set X=column b/column c
> where Column c<>0
>
> Update a
> Set X=0
> where Column c=0
>
> any help to you?
>