Solved

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

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

726 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