Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
SET (Transact-SQL)
 SET ARITHIGNORE (Transact-SQL)
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
Other versions are also available for the following:
SQL Server 2008 Books Online (October 2009)
SET ARITHIGNORE (Transact-SQL)

Controls whether error messages are returned from overflow or divide-by-zero errors during a query.

Topic link icon Transact-SQL Syntax Conventions

SET ARITHIGNORE { ON | OFF }
[ ; ]

The SET ARITHIGNORE setting only controls whether an error message is returned. SQL Server returns a NULL in a calculation involving an overflow or divide-by-zero error, regardless of this setting. The SET ARITHABORT setting can be used to determine whether the query is terminated. This setting does not affect errors occurring during INSERT, UPDATE, and DELETE statements.

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.

The setting of SET ARITHIGNORE is set at execute or run time and not at parse time.

Requires membership in the public role.

The following example shows how to use both SET ARITHIGNORE settings with both types of query errors.

SET ARITHABORT OFF;
SET ANSI_WARNINGS OFF
GO

PRINT 'Setting ARITHIGNORE ON';
GO
-- SET ARITHIGNORE ON and testing.
SET ARITHIGNORE ON;
GO
SELECT 1 / 0 AS DivideByZero;
GO
SELECT CAST(256 AS TINYINT) AS Overflow;
GO

PRINT 'Setting ARITHIGNORE OFF';
GO
-- SET ARITHIGNORE OFF and testing.
SET ARITHIGNORE OFF;
GO
SELECT 1 / 0 AS DivideByZero;
GO
SELECT CAST(256 AS TINYINT) AS Overflow;
GO
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker