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

Date Conversion - response (4) by harpreet singh

$
0
0
Here you go 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') ; SELECT '2-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') ; It will solve your issue.

Viewing all articles
Browse latest Browse all 27759

Trending Articles



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