Archives of the TeradataForum
Message Posted: Wed, 22 Dec 2010 @ 07:53:46 GMT
Subj: | | Re: PPI Table - ALTER Assistance - help!!! |
|
From: | | Dieter Noeth |
John_Wight wrote:
| Actually the column 'joiso' is an integer but has the date in it = that's what the number represent. | |
I didn't dare to suggest a typecast, because values like 20090231 in your previous definition scared me a bit :-)
> PRIMARY INDEX nupi_aswift_dspfpclog_stg ( oxsite ,oxrepr ) PARTITION
> BY RANGE_N(cast(cast(joiso AS CHAR(8)) AS DATE FORMAT 'yyyymmdd')
> BETWEEN '2008-12-31' AND '2015-12-31' EACH INTERVAL '1' MONTH ,
> NO RANGE)
> INDEX nusi01_aswift_dspfpclog_stg ( joiso );
I would avoid the double typecast int -> char -> date:
RANGE_N(CAST(joiso - 19000000 AS DATE) BETWEEN '2008-12-31' AND '2015-12-31'
EACH INTERVAL '1' MONTH ,
NO RANGE)
Of course, if this definiton works without problems, then the datatype of joiso could/should be changed to DATE.
Dieter
|