|
|
Archives of the TeradataForum
Message Posted: Mon, 03 May 2004 @ 17:15:26 GMT
Subj: | | Re: Converting time in miliseconds to TIEMSTAMP in teradata |
|
From: | | Dieter Noeth |
Victor Sokovin wrote:
| It has just occurred to me to apply the following trick and it seems to be working for the interval test values I have had in my table. I
don't have time to do more testing right now so I have no clue whether the trick will always work but I thought I should mention it for those who
might be looking now for a quick workaround. | |
| Dieter, if you are reading this: would this modification work in your test case? | |
If n < 2095 ;-)
I already found a workaround similar to Donald's CAST, but it's also wrong (similar, but not exactly):
10 * (i * n) / 10 as x,
cast(i * n as interval hour(4) to second) as x2,
i n x x2 cum_sum
----------- ---- --------------- ------------- ------------
...
0:00:01.999 2093 1:09:43.907000 1:09:43.907 1:09:43.907
0:00:01.999 2094 1:09:45.906000 1:09:45.906 1:09:45.906
0:00:01.999 2095 -0:01:47.062296 -0:01:47.062 1:09:47.905
0:00:01.999 2096 -0:01:45.063296 -0:01:45.063 1:09:49.904
0:00:01.999 2097 -0:01:43.064296 -0:01:43.064 1:09:51.903
0:00:01.999 2098 -0:01:41.065296 -0:01:41.065 1:09:53.902
0:00:01.999 2099 -0:01:39.066296 -0:01:39.066 1:09:55.901
0:00:01.999 2100 1:09:57.900000 1:09:57.900 1:09:57.900
0:00:01.999 2101 1:09:59.899000 1:09:59.899 1:09:59.899
Now MDiff is sometimes not returning the same difference. And if you calculate the difference between cum_sum and x it's not always
0.
Dieter
| |