Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 MS-SQL Birthday Query Help...

Author  Topic 

jrlvid123
Starting Member

1 Post

Posted - 2011-03-03 : 23:04:20
Hi ALL,

I have a family database program and im stuck on a trivial? matter.
Here is the query I made (Does not work accurately)

WHERE(datepart(dayofyear, [Date of Birth]) BETWEEN datepart(dayofyear, getdate()) AND datepart(dayofyear, dateadd(day, 1, getdate())))

I want it to display ONLY the day from the computers clock Skipping the Year I.E.
3/2 Will pull up only persons with a 3/2 Birthday.
Thanks in advance!
Jeff L

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-03 : 23:19:28
[code]
where month([Date of Birth]) = month(getdate())
and day([Date of Birth]) = day(getdate())
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -