Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

SQL query error Expand / Collapse
Posted Wednesday, March 6, 2013 6:57 AM


Group: General Forum Members
Last Login: Sunday, February 7, 2016 12:01 PM
Points: 448, Visits: 1,075
select cast(COL1 as datetime) from TABLE where COL1<>'' and isdate(COL1) =1 and
cast(COL1 as datetime) < (DATEADD(YY, -3, GETDATE()))

above query gives the error
Msg 8115, Level 16, State 2, Line 1
Arithmetic overflow error converting expression to data type datetime.

Any idea why?
Post #1427362
Posted Wednesday, March 6, 2013 7:28 AM



Group: General Forum Members
Last Login: Wednesday, April 27, 2016 1:45 PM
Points: 15,549, Visits: 15,699
Duplicate post. direct replies here.


Need help? Help us help you.

Read the article at for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1427392
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse