How do I check if a year is a leap year?
I have this code:
declare @year int set @year = 1968 SELECT CASE WHEN @YEAR = THEN \'LEAP
Leap year calculation:
(@year % 4 = 0) and (@year % 100 != 0) or (@year % 400 = 0)
When this is true, then it is a leap year. Or to put it in case statement
select case when ( (@year % 4 = 0) and (@year % 100 != 0) or (@year % 400 = 0) ) then 'LEAP' else 'USUAL' end ;