Relational Divide work around?

Relational Divide work around?

Post by gregory adki » Fri, 04 Feb 1994 20:25:12



I need to perform a relational divide.  Since Sybase doesn't support
this and I don't have a stored procedure, could someone
offer me any help.


 
 
 

1. Need Help Working Around 'Divide By Zero' Error From MS-SQL

I am using a stored procedure to provide data to an Active Server Page via
ADO.  Many of the fields in the SQL statement in the procedure are actually
calculations (ie PerTot = A/(A+B)).  The statement operates on about 1000
records at a time.  A record with A and B = 0 is valid.  Running the query
produces a 'Divide by zero' error, even though data is returned for the
cases where A+B > 0.  In fact I really don't care about records where A + B
= 0.  The procedure runs fine in the Query Tool with just a warning at the
bottom saying 'divide by zero occured'.

The problem is when the Active Server Page tries to open the recordset no
data is returned an I get an ODBC error Divide by zero.  I tried using 'On
Error Resume Next' to get around it but it didn't work.

Is there a way to ignore the error and access the remaining records that
worked from either the web server creating the ADO or from the SQL server?
Or do I have to go modify my calculations to look something like:

    PerTot = If (A+B > 0 Then A/(A+B) Else 0)

Thanks in advance.

2. Database will not Auto-Recover

3. Need Help with Work around: Updatable Recordset on Access Form , sql server 2000

4. concatenate varchar field from multiple rows into one row as a group

5. Upsizing work around?

6. Etta or Milan ... Q: System mdw and DBEngine

7. STUFF work-around for a text field?

8. Working Around Sql Server 7.0 MultiConnections

9. Looking for Varchar work around

10. Drill Through work around

11. work around for drill through in cubes

12. Truncate Table FOREIGN KEY constraint work around SQL 2000 SP2 .608