MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL Date format from Char format

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
YVRAMJ
Beginner


Joined: 18 Jan 2003
Posts: 12
Topics: 7

PostPosted: Thu May 01, 2003 3:19 pm    Post subject: SQL Date format from Char format Reply with quote

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.
Back to top
View user's profile Send private message
YVRAMJ
Beginner


Joined: 18 Jan 2003
Posts: 12
Topics: 7

PostPosted: Thu May 01, 2003 3:38 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group