It's been a while since I've used Teradata, but it seems to me, if the date column is of date datatype, the solution is as simple as -
select date(format 'YYYY') as year...
select date(format 'MM') as month...
select date(format 'DD') as day...
If the date column is of character datatype,
select cast(substring(date from 1 for 4) as date(format 'YYYY')) as year...
select cast(substring(date from 6 for 2) as date(format 'MM')) as month...
select cast(substring(date from 9 for 2) as date(format 'DD')) as day...
Main Topics
Browse All Topics





by: MikeOM_DBAPosted on 2005-07-15 at 11:06:44ID: 14453480
Try:
CAST(MyDate AS FORMAT 'YYYY') as A,...etc...
Or maybe:
CAST(CAST(MyDate AS FORMAT 'YYYY') AS CHAR(4)) as A,...etc...