下图是测试数据截图
解决方案
declare @nowdate datetime
set @nowdate=convert(datetime,GETDATE())
select 考生号,姓名,convert(varchar(10),生日,120)birth from
(select *, (case when not(year(@nowdate)%4=0 and year(@nowdate)%100<>0 or year(@nowdate)%400=0)
-- 判断是否为闰年
and month(生日)=2 and day(生日)=29
-- 判断考生生日是否为 2 月 29 日
then
-- 修改日期,转化为今年的年月日作条件进行判断,输出不是闰年,考生生日为 2 月 29 日的今年生日加 1