Decimal vs Numeric datatype

  • Hi All,

    I need quick help.

    create table #temp

    (

    val decimal(16,10)

    )

    insert into #temp

    select 4536426.225

    is throwing the below error message.

    Arithmetic overflow during implicit conversion of NUMERIC value '4536426.225' to a DECIMAL field .

    i wasn't able to identify the issue immediately. Please help me to get this resolved.

    it is eating my brain....

    inputs are welcome !

    karthik

  • Your decimal column allows for up to 6 digits before the decimal point, and the value you are trying to insert has 7. Thus the overflow message.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • karthikeyan (12/15/2008)


    Hi All,

    I need quick help.

    create table #temp

    (

    val decimal(16,10)

    )

    insert into #temp

    select 4536426.225

    is throwing the below error message.

    Arithmetic overflow during implicit conversion of NUMERIC value '4536426.225' to a DECIMAL field .

    i wasn't able to identify the issue immediately. Please help me to get this resolved.

    it is eating my brain....

    inputs are welcome !

    Your decimal field isn't big enough for the value you are trying to insert. DECIMAL(16,10) indicates that you have 16 digits, 10 to the right of the decimal, leaving only 6 to the left. Your number requires 7 digits to the left of the decimal point. If you really need 10 digits to the right, then change your definition to this: DECIMAL(18,10).

  • Thanks for quick reply....

    actually i got this error messag while running a job..since it was very urgent my manager sit near to me...he even not give some time to look at the issue....he urged me to do...

    once again thanks for reply...

    karthik

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply