Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Date Conversion - response (10) by harpreet singh

$
0
0
Hi Macktd, there are several wasy to tackle it.  It happens because of setting in dbs control century break parameter where we customize Teradata that if user doesnt provide a century for date then what will be century by default. now coming to solutions: 1. Change DBS control parameter century break to default 21 century 2. In case its only for your specific process that days are always 2012 and not 1912 then add interval 100 years on top of casting function. 3. If it is year 50 to 99, you want it as 1950 to 1999 and later on 00 to 49 needed to be 2000 to 2049, then do a case on the substring of yy and add 100 years or not. SELECT '12-Aug-12' AS COL1 , (CAST(CASE WHEN CHAR_LENGTH(SUBSTRING(COL1 FROM 1 FOR POSITION('-' IN COL1)-1))=1 THEN '0'||COL1 else COL1 end AS DATE FORMAT 'DD-MMM-YY') ) as col2, case when substring(trim (Extract (year from col2)) from 3) >50 then col2 else col2 +INTERVAL '100' YEAR end as finaldate    COL1             col2                 finaldate  12-Aug-12     08/12/1912       08/12/2012  

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>