Solved

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

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

910 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now