0

I'm stucked somewhere in Teradata date conversion. Can anyone please help, thanks in advance.

Table name is Test2 Table attributes are defined as:

Acct_id    Integer,
Date_num   Varchar(10) Character set Latin not casespecific

Sample Data:

Acct_id   date_num
 234124 2012-03-04
 342123 2021-04-06

When trying to cast date_num in date format getting error: Invalid date

Tried below query: Select Acct_id, to_date(Date_num, 'YYYY-MM-DD') AS DT FROM ACCT_LOAD.TEST2

I want the date to be in correct date format so I can load to another table where column attributes are defined as date.

dnoeth
  • 59,503
  • 4
  • 39
  • 56
Bikash
  • 11
  • 1
  • There seems to be some bad data. Try `Select Acct_id, Date_num FROM ACCT_LOAD.TEST2 where trycast(date_num as date) is null and date_num is not null` to find the bad rows. – dnoeth Mar 18 '22 at 14:17
  • @dnoeth trycast I tried and I think it is not working with my client's windows current version. I'm using Teradata 16.20. – Bikash Mar 19 '22 at 15:06

0 Answers0