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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-12-28 : 13:30:24
|
| Mark writes "Platform: Windows 2000 Server (all hotfixes, service packs etc)SQL Version: MS SQL Server 2000 (all fixes and service packs)I have a "Birthdays this month" stored procedure that I created that pulls the records of persons in my database born in the current month and displays thier name and age. Its been fine but now that the group has grown the list gets pretty long. What Id like to do is narrow it down further to "This WEEKS Birthdays" but I dont know how to breakout weeks for this.This is the existing stored proc I have been using.SELECT tblManifest.UserID, Users.x_firstname, Users.x_middlename, Users.x_lastname, Users.x_email, DAY(tblManifest.dob) AS Day, DATEDIFF(yyyy, tblManifest.dob, GETDATE()) AS AgeFROM tblManifest INNER JOIN Users ON tblManifest.UserID = Users.UserIDWHERE (Users.ActiveAccount = 1) AND (MONTH(tblManifest.dob) = MONTH(GETDATE())) AND (DATEDIFF(yyyy, tblManifest.dob, GETDATE()) > 17)ORDER BY DAY(tblManifest.dob)Copy of current output (view live at www.paratrooper.net)12/1 zappia R.J. - Age 47 12/3 Mcintyre Jeff S - Age 39 12/3 Aldridge Dewey Michael - Age 50 12/4 Mallow Timothy J - Age 41 Thanks for your help. I've already learned quite a bit from this site and I continue to learn." |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2001-12-28 : 14:46:28
|
Do a Forum Search (not article search) on "birthday" and you'll find a few threads where we have dealt with just this situation.And keep coming back, the learning never ends! --------------------------------------------------------------1000 Posts, Here I come! I wonder what my new title will be... |
 |
|
|
|
|
|
|
|