Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts JES2 job size field matching Windows ... SRICOBSAS All Other Mainframe Topics 4 Tue Sep 05, 2017 5:49 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us