Behavior if Both ARITHABORT and ARITHIGNORE Are Set ON

Accessing and Changing Relational Data

Accessing and Changing Relational Data

Behavior if Both ARITHABORT and ARITHIGNORE Are Set ON

If both the ARITHABORT and ARITHIGNORE query-processing options are set ON, ARITHABORT takes precedence.

ARITHABORT and ARITHIGNORE are two distinct options; setting one ON does not set the other OFF automatically. For example, if an application contains these statements then both options are set ON:

SET ARITHABORT ON
SET ARITHIGNORE ON
GO

When a SET statement is executed in a stored procedure, the new setting is active only until the procedure is completed. When the procedure is completed, the connection's setting for that option will go back to what it was before the procedure was executed.

Effect of ANSI_WARNINGS Setting

The ANSI_WARNINGS setting affect query processor behavior despite the current settings of ARITHABORT and ARITHIGNORE.

For example, even if SET ARITHABORT or SET ARITHIGNORE is OFF, if SET ANSI_WARNINGS is ON, SQL Server still returns an error message when encountering divide-by-zero or overflow errors.

This table summarizes the behavior.

ARITHABORT ANSI_WARNINGS Behavior
ON ON Abort statement only.
ON OFF Abort batch.
OFF ON Abort statement only.
OFF OFF Continue; value is NULL.

See Also

SET ANSI_WARNINGS

SET ARITHABORT

SET ARITHIGNORE