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-11-05 18:59:55