SQL Server 2008 中 Oracle 的 LAST_DAY() 函数相当于什么? [英] What is the equivalent of Oracle's LAST_DAY() function in SQL Server 2008?
本文介绍了SQL Server 2008 中 Oracle 的 LAST_DAY() 函数相当于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了 LAST_DAY() 函数在 Oracle 中是这样的:
I have used the LAST_DAY() function in Oracle like this:
Last_Day( to_date( '$pay_first_day' , 'YYYY-mm-dd') )
我必须在 SQL Server 2008 R2 数据库中做什么才能达到相同的结果?
What do i have to do in SQL server 2008 R2 database to achieve the same result?
推荐答案
试试这个 -
DECLARE @Date DATETIME
SELECT @Date = GETDATE()
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, @Date) + 1, 0) - 1
这篇关于SQL Server 2008 中 Oracle 的 LAST_DAY() 函数相当于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文