Character to Date Conversion

Database
Enthusiast

Character to Date Conversion

I have a character column which stores date ,as in, 20120310(yyyymmdd) format. There is requirement of dispalying this as 10-Mar-2012.

How can this conversion be made?

Thanks,

Kishore

Tags (1)
2 REPLIES
WAQ
Enthusiast

Re: Character to Date Conversion

You first need to convert the string into date and then format it according to your requirement.

select cast('20120310' as date format 'yyyymmdd') (format 'DD-MM-YYYY');

Teradata Employee

Re: Character to Date Conversion

Which tool you are using to display output format? ODBC may enforce its own date format on the data visible. On BTEQ though, the query above will work just fine.

HTH!