Wednesday, 17 October 2012


Procedure for find Birthday of employee before one week


1)

select * from TableName where DATEPART(DAYOFYEAR,TableName.DOB) between
DATEPART(DAYOFYEAR,GETDATE()) and DATEPART(DAYOFYEAR,dateadd(day,7,getdate()))

2)


 SELECT * from table name where DATEPART( Week, DATEADD( Year, DATEPART( Year, GETDATE()) -DATEPART( Year, DOB), DOB))= DATEPART( Week, GETDATE());

No comments:

Post a Comment