Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
MGayathri

New User


Joined: 19 May 2007
Posts: 23
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
References
PostPosted: Wed Apr 23, 2008 4:46 pm    Post subject: Re: Fetching the rows matching with current day Reply with quote

Gnanas SNG

Senior Member


Joined: 06 Sep 2007
Posts: 414
Location: 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 User


Joined: 13 Feb 2004
Posts: 270
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: 894
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: 23
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1