![]() |
|
Archives of the TeradataForumMessage Posted: Wed, 09 Jan 2008 @ 16:17:17 GMT
Anomy.Anom: It would certainly be possible to match on the YYMM portion of a date. However, you have ignored a simple truth in your:
> > where tbl1.date_YYMM = cast(current_date as char(4)) (format'YYMM')
Once you convert the date to a CHAR there is no longer anything to denote 'YYMM'. You have to format it while it is still a date:
where tbl1.date_YYMM = current_date(format'YYMM');
Then, since your date_YYMM is probably a CHAR column than you need to add the CHAR attribute to it:
where tbl1.date_YYMM = current_date(format'YYMM')(char(4));
You could also do:
where tbl1.date_YYMM = cast((current_date(format'YYMM')) as (char(4));
Hope this helps. Michael Larkins
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||