select * from T_Employee where DATEDIFF(day,GetDate(),Convert(varchar(5),DatePart(yyyy,GetDate()))+ '-'+Convert(varchar(5),DATEPART(mm,BirthDay)) +'-'+Convert(varchar(5),DATEPART(dd,BirthDay))) between 0 and 3
PS:表名-T_Employee;生日字段名-DateOfBirth。
select * from T_Employee where DATEDIFF(day,GetDate(),Convert(varchar(5),DatePart(yyyy,GetDate()))+ '-'+Convert(varchar(5),DATEPART(mm,BirthDay)) +'-'+Convert(varchar(5),DATEPART(dd,BirthDay))) between 0 and 3
PS:表名-T_Employee;生日字段名-DateOfBirth。
转载于:https://www.cnblogs.com/tianqy/p/3959591.html