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.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/|||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?|||Or perhaps something like:
Update a
Set X= case when columnc=0 then 0 else column b/column c end
MC
"yangyang" <loveflying000@.gmail.com> wrote in message
news:1141834929.055768.75450@.v46g2000cwv.googlegro ups.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?
No comments:
Post a Comment