Dela via


Behavior When ARITHABORT and ARITHIGNORE Are Set to ON

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

ARITHABORT and ARITHIGNORE are two distinct options; setting one to ON does not automatically set the other to OFF. For example, if an application contains the following statements, both options are set to 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 affects query processor behavior regardless of the current settings of ARITHABORT and ARITHIGNORE.

For example, if SET ARITHABORT or SET ARITHIGNORE is set to OFF and SET ANSI_WARNINGS is set to ON, Microsoft SQL Server will still return an error message when it encounters 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.