Nov 29, 2005 #1 vladab Programmer Aug 13, 2002 13 US I am trying to convert a field of CHARACTER(8) data type into Date format 'yyyy-mm-dd'. The following query produce 2665 (Invalid date) error : select cast('20041101' as date format 'yyyy-mm-dd') from table_name Please advice how to fix this error. Vlada
I am trying to convert a field of CHARACTER(8) data type into Date format 'yyyy-mm-dd'. The following query produce 2665 (Invalid date) error : select cast('20041101' as date format 'yyyy-mm-dd') from table_name Please advice how to fix this error. Vlada
Nov 30, 2005 #2 al1x24 Programmer Oct 11, 2005 9 FR I think that select cast('20041101' as date format 'yyyymmdd') would give a better result. Upvote 0 Downvote
Nov 30, 2005 Thread starter #3 vladab Programmer Aug 13, 2002 13 US Yes. I already changed it to the way you are suggesting and it worked. Thank you. Upvote 0 Downvote
Dec 30, 2005 #4 ripperfuel IS-IT--Management Dec 29, 2005 3 US How about this: select cast(cast('20041101' as date format 'yyyymmdd') as date format 'yyyy-mm-dd'); *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second. '20041101' ---------- 2004-11-01 Upvote 0 Downvote
How about this: select cast(cast('20041101' as date format 'yyyymmdd') as date format 'yyyy-mm-dd'); *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second. '20041101' ---------- 2004-11-01