IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Fetching the rows matching with current day


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 792
Location: Chennai, India

PostPosted: Wed Apr 23, 2008 4:58 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To get the the current time DFSORT/ICETOOL 13
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Changeman - how can we know the curr... Compuware & Other Tools 2
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top