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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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