Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us