Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / English Query / August 2008

Tip: Looking for answers? Try searching our database.

Adding a value to a 'datetime' column caused overflow.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dt - 26 Aug 2008 21:23 GMT
This is a simple select statement where I am trying to convert a Julian date.
Where one of the fields is zero I get this error.

My Select statement is:

select
DATEPART(yy, DATEADD(dd, date_last_inv - 722815, '1/1/80'))as date_last_inv,
DATEPART(yy, DATEADD(dd, date_last_cm - 722815, '1/1/80')) as date_last_cm,
DATEPART(yy, DATEADD(dd, date_last_pyt - 722815, '1/1/80'))as date_last_pyt
from aractcus

the date_last_inv, cm, pyt is a int column.  How can I get around the zero's.

The full error is:

Server: Msg 517, Level 16, State 1, Line 1
Adding a value to a 'datetime' column caused overflow.
Tariq - 27 Aug 2008 15:26 GMT
Try it,

SELECT
CASE WHEN DATE_LAST_INV>640000 THEN DATEPART(YY, DATEADD(DD, DATE_LAST_INV -
722815, '1/1/80')) ELSE 0 END AS DATE_LAST_INV,
CASE WHEN DATE_LAST_INV>640000 THEN DATEPART(YY, DATEADD(DD, DATE_LAST_CM -
722815, '1/1/80')) ELSE 0 END AS DATE_LAST_CM,
CASE WHEN DATE_LAST_INV>640000 THEN DATEPART(YY, DATEADD(DD, DATE_LAST_PYT -
722815, '1/1/80')) ELSE 0 ENDAS DATE_LAST_PYT
FROM ARACTCUS
dt - 27 Aug 2008 17:06 GMT
Thank you.

> Try it,
>
[quoted text clipped - 6 lines]
> 722815, '1/1/80')) ELSE 0 ENDAS DATE_LAST_PYT
> FROM ARACTCUS
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.