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

DB2 query - to retrive employees whose b'day is today?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lara

New User


Joined: 31 May 2006
Posts: 5

PostPosted: Wed May 31, 2006 4:46 pm
Reply with quote

What is the query to find out all employee IDs whose birthday fall today ?
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Wed May 31, 2006 5:25 pm
Reply with quote

Lara,

Please give table defination
Back to top
View user's profile Send private message
sihanature
Warnings : 1

New User


Joined: 01 Sep 2005
Posts: 33

PostPosted: Wed May 31, 2006 6:28 pm
Reply with quote

Yeah,

If you give info about the table you using, we can provide the query using
Current date .

Regards,
Back to top
View user's profile Send private message
umavivekanand

New User


Joined: 26 Apr 2006
Posts: 5
Location: Banglore

PostPosted: Thu Jun 01, 2006 12:37 pm
Reply with quote

Hi

i guess this shd work with some modifications to suit ur table name & field names

Select empid from emp_table where bday=current date;

the date format for the Current date is YYYY-MM-DD

pls let me know if this works !

Thx
uma
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Thu Jun 01, 2006 1:00 pm
Reply with quote

Hi,
Just a small correction,

Select empid from emp_table where bday=current_date;

it should be current_date instead of 'current date'

Thanks,
Parikshit.
Back to top
View user's profile Send private message
lara

New User


Joined: 31 May 2006
Posts: 5

PostPosted: Thu Jun 01, 2006 1:19 pm
Reply with quote

Hi,

Table name : Employee
Columns : Emp_name & Emp_Bdate(mmddyyyy)

There is a small catch in it as current_date built-in function will give the full year. The years wont match because employee's birth year wud not be current year.


Thanks,
Lara
Back to top
View user's profile Send private message
steve

New User


Joined: 24 Mar 2005
Posts: 16
Location: Long Island

PostPosted: Thu Jun 01, 2006 4:11 pm
Reply with quote

I just tried the following query on CA- DATACOM. Hope it works for DB2 too.. pls try..

select emid from employee WHERE month(EMBDAT) = month(CURRENT TIMESTAMP) and day(embdat) = day(current timestamp) fetch first 20 rows only
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top