Arithmetic overflow error converting expression to data type datetime.

  • good evening:

    i have a huge table tin sql 2000 and it has 1148052581

    when i use select o select count_big(*) command it yields an error:

    select count_big(*) from HECHOS_MOVTO_PREPAGO_ACTUACIONES

    where FEC_ACTUALIZACION >= 20090201 and FEC_ACTUALIZACION <= 20091231

    Arithmetic overflow error converting expression to data type datetime.

    how can i handle this error and execute the query without any eroor?

    id appreciate your help

  • Single Quotes...

    select count_big(*) from HECHOS_MOVTO_PREPAGO_ACTUACIONES

    where FEC_ACTUALIZACION >= '20090201' and FEC_ACTUALIZACION <= '20091231'

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • You are getting an implicit conversion, expecting SQL Server to convert those integer values for you. As Jeff mentioned, you want to use quotes around dates to explicitly state the values are dates and not numbers.

  • pavargasq (12/5/2010)


    id appreciate your help

    Heh... we'd appreciate a little feedback. 😉 Did that fix it for you or not?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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