Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Divide by zero, but I still want the sp to execute

Posted on 1998-02-16
2
Medium Priority
?
259 Views
Last Modified: 2012-06-27
Hi!
I have written a Stored Procedure that does an update
of a table triggered by the user of my VB client.

Sometimes this SP encounters division by zero and gives
me the message:
Divide by zero occurred.

This is Ok by me and by Enterprise Manager. The SP executes
what it is supposed to do anyhow. But from VB (using RDO)
it fails because of this error.

So the question is:
What can I do in my SP to prevent it from failing when
it is called by the VB-client?
I have tried with setting some options but it didnt work.

Appreciate help!

                               // Kalle
0
Comment
Question by:Kalle 2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
Jim_SQL earned 1200 total points
ID: 1090290
Hi,

Without your SP I can't say exactly, but hopefully you'll get the idea:

update SomeTable
set field_c = CASE field_b WHEN 0 THEN 0 ELSE field_a/field_b END


If this doesn't help, please post you query/SP.

(Hope this helped.)
Jim
0
 

Author Comment

by:Kalle 2
ID: 1090291
I got the idea, thanks!

                       // Kalle
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question