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

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


Group: General Forum Members
Last Login: Sunday, August 30, 2015 6:38 AM
Points: 438, Visits: 1,061
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: Yesterday @ 3:28 PM
Points: 14,768, Visits: 14,576
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