Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server 2000

Status
Not open for further replies.

Josh01

Programmer
Joined
Jan 9, 2002
Messages
23
Location
GB
I am trying a simple percentage analysis using two fields, i keep getting a divide by zero error and can not seem to get around it. I am aware that there are zeros in one of the columns but cant seem to successfully change/ignore them.
 
Hi Josh01,

declare @d int
select @d=0
select case @d
when 0 then null
else 8/@d end as res

select @d=2
select case @d
when 0 then null
else 8/@d end as res


u can try something like this !!!

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top