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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Date Function

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-16 : 00:16:46
Gary writes "I have a SQL 7.0 database built with a list of our employees. I would like to have a web page display the names of the employees who are celebrating their anniversary with the company.

I can get the query to give me the names if I put the month and the day entry in the query. Here is the query:

select lname, fname, emp, center, seniority
from dbo.employees
where datepart(mm, seniority )= 4 and datepart(dd, seniority)= 14
order by seniority

Here are the results:

KORNEGAY GLENWOOD 60165 7211 1978-04-14 00:00:00

My question to the masters is how can I replace the month number 4 and day number 14 in the query to a getdate() function so I don't have to make 365 different queries?

I have tried everything I can think of but can't get it to work.

Thanks.

Gary Costigan
Dallas, Tx."
   

- Advertisement -