Transact-SQL Reference

SET ARITHIGNORE

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

Syntax

SET ARITHIGNORE { ON | OFF }

Remarks

The SET ARITHIGNORE setting only controls whether an error message is returned. Microsoft® 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 or not the query is terminated. This setting has no effect on 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.

Permissions

SET ARITHIGNORE permissions default to all users.

Examples

This example demonstrates both SET ARITHIGNORE settings with both types of query errors.

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

PRINT 'Setting ARITHIGNORE OFF'
GO
-- SET ARITHIGNORE OFF and testing.
SET ARITHIGNORE OFF
GO
SELECT 1/0
GO
SELECT CAST(256 AS tinyint)
GO

See Also

SET

SET ARITHABORT