 |
|
 |
|
Next: detektei regensburg in Cuxhaven und detektivbuero..
|
| Author |
Message |
External

Since: Aug 26, 2008 Posts: 2
|
(Msg. 1) Posted: Tue Aug 26, 2008 1:23 pm
Post subject: Adding a value to a 'datetime' column caused overflow. Archived from groups: microsoft>public>sqlserver>mseq (more info?)
|
|
|
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. >> Stay informed about: Adding a value to a 'datetime' column caused overflow. |
|
| Back to top |
|
 |  |
External

Since: Aug 27, 2008 Posts: 3
|
(Msg. 2) Posted: Wed Aug 27, 2008 7:26 am
Post subject: RE: Adding a value to a 'datetime' column caused overflow. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
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 >> Stay informed about: Adding a value to a 'datetime' column caused overflow. |
|
| Back to top |
|
 |  |
External

Since: Aug 26, 2008 Posts: 2
|
(Msg. 3) Posted: Wed Aug 27, 2008 9:06 am
Post subject: RE: Adding a value to a 'datetime' column caused overflow. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Thank you.
"Tariq" wrote:
> 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
> >> Stay informed about: Adding a value to a 'datetime' column caused overflow. |
|
| Back to top |
|
 |  |
| Related Topics: | datetime comparison broken??? - I've spent a few hours researching the datetime comparison, and from what I understand, what I'm doing *should* be working... any help is GREATLY appreciated. I have a table that stores a column (EventDateTime) in the datetime format. If I run a..
Error converting data type nvarchar to datetime - Good morning :) * Using QL Server 2005 I have created a stored procedure (first time I have done this). It worked fine when I only had 1 variable (the ProjectCode variable). However when I add in the PostedDate variable and try and use it I get the ...
Cannot Reference Named Column in WHERE Clause - SQL Server 2005. I have a view defined for a database. Part of the query is: SELECT dbo.GL7PROJECTS.PROJECTID AS JURISDICTION I have not problem using JURISDICTION in the ORDER BY clause, but when I try to use it in a WHERE clause (e.g., WHERE..
index on a view - Hello, I have a table (TAB) and A View with alias (VIEW) Table cod varchar 3 descr carchar 60 my view cod alias COd1 descr alias DES Now i need a index on view with key COD1 I can't create it. Can..
Creating an alias - I have an alias that can get very long because it maintains a information of where it came from. Is there a way to alias an alias? My first thought was: Declare @T1 varchar(128) Set T1 = 'MyAlias' .... Inner Join Table1 as @T1 This of course does no... |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|