Solved

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

Posted on 1998-02-16
2
250 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 300 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

729 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