Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Arithmetic overflow error converting expression to data type datetime. Expand / Collapse
Author
Message
Posted Sunday, December 5, 2010 5:50 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Saturday, December 8, 2012 8:24 PM
Points: 40, Visits: 135
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
Post #1030412
Posted Sunday, December 5, 2010 5:56 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 9:34 AM
Points: 35,532, Visits: 32,115
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1030414
Posted Sunday, December 5, 2010 6:04 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 10:17 AM
Points: 31,278, Visits: 15,731
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.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1030418
Posted Monday, December 6, 2010 8:28 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 9:34 AM
Points: 35,532, Visits: 32,115
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."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1030977
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse