Re: SQL SERVER QUESTION,divided by zero error, urgent please!!!!

Re: SQL SERVER QUESTION,divided by zero error, urgent please!!!!

 

  


On 10/22/2002 11:58:48 AM Bernita Joseph wrote:
> HI List,
>
> I'm getting a zero divided by error. The script look something like this:
>
> SELECT DISTINCT d.ID, d.alignment_sheet_name FROM (((pn_alignment_sheet a
> inner join pn_alignment_sheet b
> on a.id = b.id) inner join pn_alignment_sheet c on b.id = c.id) inner join
> pn_alignment_sheet d on c.id = d.id)
> WHERE
> ((((a.Y2-a.Y0-((a.Y1-a.Y0)/((a.X1+0.000111)-a.X0))*(a.X2-a.X0))>0)
> AND ((33.36-a.Y0-((a.Y1-a.Y0)/((a.X1+0.000111)-a.X0))*(-111.9528-a.X0))>0))
> OR (((a.Y2-a.Y0-((a.Y1-a.Y0)/((a.X1+0.000111)-a.X0))*(a.X2-a.X0))<=0)
> AND
> ((33.36-a.Y0-((a.Y1-a.Y0)/((a.X1+0.000111)-a.X0))*(-111.9528-a.X0))<=0)))
>

What you want to do is look at your divisors and see if they come out to 0 for any of your calculations.
Since you are multiplying before dividing, there are only 3 cases where you could get a zero which is then multiplied by a number the result of which is divided.
The situations where this could occur are:

a.X1+0.000111-a.X0 = 0
a.X2-a.X0 = 0
-111.9528-a.X0 = 0

I would suggest writing a query to find out what part of your data meets this criteria. I suspect that something like the following would work:

SELECT X1,X0,X2
FROM pn_alignment_sheet
where X1 + 0.000111 - X0 = 0
or X2 - X0 = 0
or -111.9528 - X0 = 0




. . . Tom

Tom Zeblisky




-----------------------------------------------------------------
Visit our Internet site at http://www.reuters.com

Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Reuters Ltd.
MS Sql Server LazyDBA home page