Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Fetching the rows matching with current day

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Apr 23, 2008 4:46 pm    Post subject: Fetching the rows matching with current day
Reply with quote

Want to fetch the rows from a table if the Current DAY matches with Day value of Eff-date field which is of Character Type
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Wed Apr 23, 2008 4:58 pm    Post subject:
Reply with quote

Why Eff-date column is in as Char?

Please look at the manual for Date and conversion functions.
Back to top
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Wed Apr 23, 2008 5:09 pm    Post subject:
Reply with quote

If you know the position in Eff-date where day will come use Substr


select * from table where
substr(Eff_date,1,2)= char(day(current date));

assuming the eff-date is of format DD-MM-YYYY...
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Apr 23, 2008 5:22 pm    Post subject:
Reply with quote

ashimer wrote:
If you know the position in Eff-date where day will come use Substr


select * from table where
substr(Eff_date,1,2)= char(day(current date));

assuming the eff-date is of format DD-MM-YYYY...


That will only work if there is just 1 months worth of data in the table.
What format is EFF_DATE in (mm/dd/yyyy yyyy-mm-dd etc)?
Back to top
View user's profile Send private message
MGayathri

New User


Joined: 19 May 2007
Posts: 25
Location: Chennai

PostPosted: Wed Apr 23, 2008 6:14 pm    Post subject:
Reply with quote

thanks a lot it helped me
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us