• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1068
  • 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

Featured Post

Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

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