• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1094
  • Last Modified:

Divide by zero error on SQL Server 2005 (SET ARITHIGNORE ON)

sql server 2005 BOL states that you can specify ARITHIGNORE ON to ignore div by zero errors.

See example in:
http://msdn2.microsoft.com/en-us/library/ms184341.aspx

This setting however seems to make no difference, and SQL server will abort with an error.

Anyone else come across this/ideas?

Thanks
0
CMGL
Asked:
CMGL
  • 2
1 Solution
 
appariCommented:
in tha same page if you read it fine it says(in remarks section)

If either SET ARITHABORT or SET ARITHIGNORE is OFF and SET ANSI_WARNINGS is ON, SQL Server still returns an error message when encountering divide-by-zero or overflow errors.

so you need to set
SET ANSI_WARNINGS  off
0
 
appariCommented:
then SET ARITHIGNORE ON
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
u can use eception handling if you are using sql 2005

http://sequelserver.blogspot.com/2007/07/exception-handling-using-trycatch.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now