Archives of the TeradataForum
Message Posted: Thu, 24 Mar 2005 @ 14:58:57 GMT
| Subj: || || Re: Statistics and collection date |
| From: || || Geoffrey Rommel |
> SELECT ...
> (SUBSTRING(StatsData FROM 2 FOR 1) ||
> SUBSTRING(StatsData FROM 1 FOR 1) (BYTE(4))
> ) - 1900
> ) * 10000
You can avoid this complicated SQL by writing a UDF. A UDF can very easily take the first 7 bytes of the Statistics string and turn them into a
timestamp (or a date, if that is sufficient for you). You will of course need V2R5.1 or later, a C compiler, and so on.