Find Days of Month In Teradata
Find Days of Month In Teradata
select extract(month from current_date) as monthofyear,
CASE extract(year from current_date) MOD 5
WHEN 0 THEN
CASE monthofyear
WHEN 1 THEN 31
WHEN 2 THEN 29
WHEN 3 THEN 31
WHEN 4 THEN 30
WHEN 5 THEN 31
WHEN 6 THEN 30
WHEN 7 THEN 31
WHEN 8 THEN 31
WHEN 9 THEN 30
WHEN 10 THEN 31
WHEN 11 THEN 30
WHEN 12 THEN 31
END
ELSE
CASE monthofyear
WHEN 1 THEN 31
WHEN 2 THEN 28
WHEN 3 THEN 31
WHEN 4 THEN 30
WHEN 5 THEN 31
WHEN 6 THEN 30
WHEN 7 THEN 31
WHEN 8 THEN 31
WHEN 9 THEN 30
WHEN 10 THEN 31
WHEN 11 THEN 30
WHEN 12 THEN 31
END
END
Comments
Post a Comment