Archives of the TeradataForum
Message Posted: Wed, 18 Apr 2012 @ 19:30:52 GMT
A couple of options.
Your problem is because the literal that you are supplying in the query has a numeric data type and therefore it is being treated as the absolute date value, hence 07 becomes 1907.
Solutions, any of:
- if your dates are always 20xx, add 100 to it, so CAST(1070401 AS DATE) will be treated as 2007-04-01
- enclose the existing value within quotes which makes it a string literal, but be aware that the 2-digit year will then be subject to the CenturyBreak setting in DBSControl. By default CenturyBreak has a value of 0 and so '07' will still be treated as 1907. Whther this works or not depends on the CenturyBreak setting in DBSControl.
- if your dates are always 20xx, then enclose a modified version of the string (with '20' concatenated on the front) so that CenturyBreak is ignored.
There are probably other options as well. Dealing with dates there are so many ways of converting them.
Ward Analytics Ltd - Information in motion (www.ward-analytics.com)
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|