Sql Get Last Day of Month...
2010-05-12 17:24
411 查看
-- Sql Get Last Day of Month...
SELECT (CASE MONTH(GETDATE())
WHEN 1 THEN 31
WHEN 2 THEN (CASE YEAR(GETDATE())%4 WHEN 0 THEN 29 ELSE 28 END)
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) AS LastDayOfMonth
SELECT (CASE MONTH(GETDATE())
WHEN 1 THEN 31
WHEN 2 THEN (CASE YEAR(GETDATE())%4 WHEN 0 THEN 29 ELSE 28 END)
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) AS LastDayOfMonth
相关文章推荐
- How to Get First and Last Day of a Month in SQL Server
- 【SQL】How to get First and Last day of a month – TSQL
- Sql Get Last Day of Month...
- How to Get First and Last Day of a Week in SQL Server
- 【SQL】How to get First and Last day of a Year – TSQL
- ORA-01847: day of month must be between 1 and last day of month 解决方法
- SQL - How to get the current day, month and year
- OGG ORA-01847: day of month must be between 1 and last day of month (status = 1847)
- calendar.getActualMaximum(calendar.DAY_OF_MONTH)的陷阱
- SQL Tip of the day: get a specific range of results
- ABAP CALL FUNCTION 'DATE_GET_MONTH_LASTDAY' 取每月最后一天 'DATE_GET_WEEK'取周
- Oracle 之 ORA-01847: day of month must be between 1 and last day of month
- ORA-01847: day of month must be between 1 and last day of month
- ORA-01847: day of month must be between 1 and last day of month 解决方法
- How to Get Sql sever 2000 WeekFirstDay and WeekLastDay...
- oracle日期时间段查询遇到问题to_date ora-01847 day of month must be between 1 and last day of month
- How to Get Sql sever 2000 WeekFirstDay and WeekLastDay...
- Andrdoi 如何获得某个月份最后一天(或号数最大那天)的号数?--使用getActualMaximum(Calendar.DAY_OF_MONTH)!
- get the last date of a month in oracle
- Linux内核中获取时间函数do_gettimeofday