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。
2024-01-13 15:32:10
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。