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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: DB2 query - to retrive employees whose b'day is today?
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: 1187
Location: Bangalore,India

PostPosted: Wed May 31, 2006 5:25 pm    Post subject:
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    Post subject:
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    Post subject: Re: DB2 query - to retrive employees whose b'day is today?
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    Post subject:
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    Post subject: Re: DB2 query - to retrive employees whose b'day is today?
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm
No new posts GETMAIN/FREEMAIN query Suja.Sai CICS 9 Tue Jan 31, 2017 12:01 pm


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