Hello All ,
I am trying to convert a date Format (CYYMMDD) to (YYYYMMDD) format and i am using the below in my query
if its 1900512 ----> it should be 19900512 and if it is 2060516 -----> it should be 20060516
CAST(CASE WHEN SUBSTRING(RIGHT('00'+ CAST(A.BIRTH_DT AS VARCHAR), -
7),1,1)='1' THEN '19' ELSE '20' END + -
SUBSTRING(RIGHT('00' + CAST(A.BIRTH_DT AS VARCHAR), 7), 2,2) -
+ SUBSTRING(RIGHT('00'+ CAST(A.BIRTH_DT AS VARCHAR),7),4,4)AS DATE) -
AS CONVERTED DATE,
But i am getting a -604 error code . Please can you let me know the issue in the above
Regards
Nagesh