Arithmetic OverFlow: It occur when we try to insert a value in a column or assign a value to a variable which is more than the limit of data type.
Let' say we have a variable of numeric type with size
Declare @IsArithmeticOverFlow numeric(5,2)
SET @IsArithmeticOverFlow = 999.999
SELECT @IsArithmeticOverFlow
will get the airthmetic error error here while executing the above statement because we defined the size of variable (5,2) and IsArithmeticOverFlow vaiable have the capacity to hold the value upto only 999, not more than it. but the value 999.999 is rounding to nearest vale. so, after rounding, the nearest vale is 1000. and the variable don't have the capacity now to hold 1000. so in this situation, will get arithmetic overflow error
Declare @IsArithmeticOverFlow numeric(6,2)
SET @IsArithmeticOverFlow = 999.999
SELECT @IsArithmeticOverFlow
![]() |


No comments:
Post a Comment