最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

EOMONTH function in SQL Server 2012

网络文摘 William 1743浏览 0评论

Dear Friends,

A few weeks ago, I was writing some stored procs in SQL Server and I found this EOMONTH function handy.

This is a new function in SQL Server 2012

EOMONTH function takes a date argument/parameter and returns the last day of that month.

Quite handy.

Please refer to this technet article below for detailed syntax and some examples

http://technet.microsoft.com/en-us/library/hh213020.aspx

And if you would like to know how to achieve this in previous versions of SQL, have a look at the below link.

http://www.sql-server-helper.com/tips/tip-of-the-day.aspx?tkey=49ffa5c2-03a3-4888-aac2-a80320f2faf4&tkw=last-day-of-the-month-function

Btw, in AX, we have an equivalent dateEndMth function in Global class for the above purpose.


Happy Querying :)


发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址