sql server生日提醒语句实现方法

--当天过生日的
select * from dbo.CUSTOM_BASE where month(DATEOFBIRTH) = month(getdate()) and day(DATEOFBIRTH) = day(getdate())

--三天以内过生日的

select * from CUSTOM_BASE where month(DATEOFBIRTH) = month(dateadd(dd,3,getdate())) and (day(DATEOFBIRTH) = day(dateadd(dd,3,getdate())) or day(DATEOFBIRTH) = day(dateadd(dd,2,getdate())) or day(DATEOFBIRTH)=day(dateadd(dd,1,getdate())))

posted @ 2017-05-07 15:32  奕成软件  阅读(1990)  评论(1编辑  收藏  举报