Behaviour of SET NUMERIC_ROUNDABORT and SET ARITHABORT
This specifies the level of Error Reporting generated when rounding in an expression causes a loss of precision
------------Here SET NUMERIC_ROUNDABORT ON and SET ARITHABORT OFF
SET NOCOUNT ON
PRINT 'SET NUMERIC_ROUNDABORT ON'
PRINT 'SET ARITHABORT ON'
SET NUMERIC_ROUNDABORT ON
SET ARITHABORT ON
GO
DECLARE @Result DECIMAL(5,2),
@Value_1 DECIMAL(5,4),
@Value_2 DECIMAL(5,4)
SET @Value_1=1.1234
SET @Value_2=1.1234
SELECT @Result=@Value_1+@Value_2
SELECT @Result
-------Here SET NUMERIC_ROUNDABORT OFF and SET ARITHABORT ON
SET NOCOUNT ON
PRINT 'SET NUMERIC_ROUNDABORT OFF'
PRINT 'SET ARITHABORT ON'
SET NUMERIC_ROUNDABORT OFF
SET ARITHABORT ON
GO
DECLARE @Result DECIMAL(5,2),
@Value_1 DECIMAL(5,4),
@Value_2 DECIMAL(5,4)
SET @Value_1=1.1234
SET @Value_2=1.1234
SELECT @Result=@Value_1+@Value_2
SELECT @Result
------------------Here SET NUMERIC_ROUNDABORT OFF and SET ARITHABORT OFF
SET NOCOUNT ON
PRINT 'SET NUMERIC_ROUNDABORT OFF'
PRINT 'SET ARITHABORT OFF'
SET NUMERIC_ROUNDABORT OFF
SET ARITHABORT OFF
GO
DECLARE @Result DECIMAL(5,2),
@Value_1 DECIMAL(5,4),
@Value_2 DECIMAL(5,4)
SET @Value_1=1.1234
SET @Value_2=1.1234
SELECT @Result=@Value_1+@Value_2
SELECT @Result
------------Here SET NUMERIC_ROUNDABORT ON and SET ARITHABORT OFF
SET NOCOUNT ON
PRINT 'SET NUMERIC_ROUNDABORT ON'
PRINT 'SET ARITHABORT ON'
SET NUMERIC_ROUNDABORT ON
SET ARITHABORT ON
GO
DECLARE @Result DECIMAL(5,2),
@Value_1 DECIMAL(5,4),
@Value_2 DECIMAL(5,4)
SET @Value_1=1.1234
SET @Value_2=1.1234
SELECT @Result=@Value_1+@Value_2
SELECT @Result
-------Here SET NUMERIC_ROUNDABORT OFF and SET ARITHABORT ON
SET NOCOUNT ON
PRINT 'SET NUMERIC_ROUNDABORT OFF'
PRINT 'SET ARITHABORT ON'
SET NUMERIC_ROUNDABORT OFF
SET ARITHABORT ON
GO
DECLARE @Result DECIMAL(5,2),
@Value_1 DECIMAL(5,4),
@Value_2 DECIMAL(5,4)
SET @Value_1=1.1234
SET @Value_2=1.1234
SELECT @Result=@Value_1+@Value_2
SELECT @Result
------------------Here SET NUMERIC_ROUNDABORT OFF and SET ARITHABORT OFF
SET NOCOUNT ON
PRINT 'SET NUMERIC_ROUNDABORT OFF'
PRINT 'SET ARITHABORT OFF'
SET NUMERIC_ROUNDABORT OFF
SET ARITHABORT OFF
GO
DECLARE @Result DECIMAL(5,2),
@Value_1 DECIMAL(5,4),
@Value_2 DECIMAL(5,4)
SET @Value_1=1.1234
SET @Value_2=1.1234
SELECT @Result=@Value_1+@Value_2
SELECT @Result
Comments