The Solution 1 given by

__Mehdi Gholam__ is very good.

I want to add the following since the OP wants to know specifically why error was not thrown in the first case and why error is thrown in the second case.

As seen from the statements

SELECT CAST(1234567891234567.34 AS NUMERIC(18,2))
SELECT CAST(1234567891234567.34 AS NUMERIC(18,10))

it is clear that, in the first case from the statement

`NUMERIC(18,2)`

the total digits are 18 and 16 digits are available to the left of decimal, whereas

`1234567891234567 `

are 16 digits. Hence, there is no error.

In the second case, from the statement

`NUMERIC(18,10)`

, 8 digits are available to the left of decimal, but

`1234567891234567`

are 16 digits which is more than 8 digits. Hence, Arithmetic overflow error occurs.