YVRAMJ Beginner
Joined: 18 Jan 2003 Posts: 12 Topics: 7
|
Posted: Thu May 01, 2003 3:19 pm Post subject: SQL Date format from Char format |
|
|
Hi,
Is there any way we can convert the date value stored as a char(8) column in a DB2 table to a date column ? I tried different scalar functions.
I couldn't get it. We use DB2 V7 in our shop.
For example --
If the char date stored as '20001120' and I want to select it as a DB2 date column in format 'ddmmmyyyy'. ( 20NOV2000 ). Please let me know.
Thanks,
Ram. |
|
YVRAMJ Beginner
Joined: 18 Jan 2003 Posts: 12 Topics: 7
|
Posted: Thu May 01, 2003 3:38 pm Post subject: |
|
|
Hi,
I found the solution. If I use substr funtion and date function
it is working as below.
SELECT (DATE(SUBSTR(CUR_QUOTE_ENTER_DT,1,4)||'-'||
SUBSTR(CUR_QUOTE_ENTER_DT,5,2)||'-'||
SUBSTR(CUR_QUOTE_ENTER_DT,7,2)))
FROM CEDDBAP.SM_MISC
Thanks. |
|