﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by bitbucket  / EOMONTH - 1 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 02:49:03 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>get 1 point without running the codebut last day of 2016 is pure chance !</description><pubDate>Fri, 22 Feb 2013 01:47:12 GMT</pubDate><dc:creator>jfgoude</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>I still don't get why people when talking about Dates include a Time Component. Dates are Dates and Time is Time. We have had Date &amp; Time Data Types for many years now but it seems SQL Server folk love their datetime and all of the Arcane knowledge required to use it.Personally I'd like to see datetime deprecated so that we're left with Date, Time &amp; DateTime2.I'm interested to know who is still using datetime when all that they really want is Date.End of Rant.David</description><pubDate>Tue, 19 Feb 2013 22:51:07 GMT</pubDate><dc:creator>David Conn</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Thank you for the question.</description><pubDate>Tue, 22 Jan 2013 04:16:17 GMT</pubDate><dc:creator>(Bob Brown)  </dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Even though i got idea about the function from BOL, I don't want to sit and calculate what will be the last day of 2016 or last day of february 2016.So I created an UDF to do the work of EOMONTH() and excuted the script to find the answer of QotD.I thank [b]Ron[/b] for introducing this new function to most of us..</description><pubDate>Mon, 21 Jan 2013 22:04:06 GMT</pubDate><dc:creator>Dineshbabu</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Revenant (1/21/2013)[/b][hr]Ron, as always I love your question. Please keep them comin'![/quote]Thank you .. coming from one as knowledgable as you about sql ... it is an honor</description><pubDate>Mon, 21 Jan 2013 13:14:05 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Ron, as always I love your question. Please keep them comin'!</description><pubDate>Mon, 21 Jan 2013 12:05:03 GMT</pubDate><dc:creator>Revenant</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]L' Eomot Inversé (1/21/2013)[/b][hr][quote][b]Hugo Kornelis (1/21/2013)[/b][hr]... But in SQL Server 2012, there are definitely a lot of new function that are totally useless - except if you want to enable an easier transition from VBA and Access SQL to T-SQL. EOMONTH is one of them, IIF is a very clear example, and I think there were a few more, but I don't have the time to hunt them all down now.[/quote]I take a different view of Eomonth: anything that makes the developer's life easier is a useful function.  It is a lot easier to write EOMONTH(somedate) for example than to write cast(DATEADD(DAY,-DATEPART(DAY,somedate),DATEADD(MONTH,1,somedate)) AS DATE).  A developer is unlikely to get an EOMONTH call wrong, and you can't say the same for a construction of the same function from datepart and dateadd.  It's also a lot easier to read  the Eomonth call, to see instantly what it means, and hence to debug and maintain and enhance - so there is a lot of real business value in that function.It would have saved me some pain if my people could have used something like EOMONTH back in the days of SQL Server 2000.  And since we were a shop where the scripting language was JScript not VBA that wasn't because people were converting anything which already used an EOMONTH function.Maybe some of the other functions are a bit useless, though.[/quote]My main issue with EOMONTH is that it's a lost opportunity to do something *really* useful, and a whole bunch of future forum questions.It's just too compelling to write "WHERE MyDateColumn BETWEEN *something to calculate the first day of the current month* AND EOMONTH(getdate())" - but that would in many cases not return the correct results. EOMONTH always returns the last day of the month with time 0:00, so if my data stores time as well, I lose all events on the last day. For regular datetime data, I would want a function to return 23:59:59.997; for smalldatetime 23:59; for datetime2(7) 23:59:59.9999999, and for my specific data that is constrained to store only whole hours I want 23:00.So for me, a far better choice would have been to implement a BOMONTH (for the first day of the month - though one can wonder how much this simplifies life, as the first of the month is pretty easy to get anyway) and then use a DATEDIFF to subtract 3ms, 1 second, 100 ns, or an hour.</description><pubDate>Mon, 21 Jan 2013 08:18:06 GMT</pubDate><dc:creator>Hugo Kornelis</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Hugo Kornelis (1/21/2013)[/b][hr]... But in SQL Server 2012, there are definitely a lot of new function that are totally useless - except if you want to enable an easier transition from VBA and Access SQL to T-SQL. EOMONTH is one of them, IIF is a very clear example, and I think there were a few more, but I don't have the time to hunt them all down now.[/quote]I take a different view of Eomonth: anything that makes the developer's life easier is a useful function.  It is a lot easier to write EOMONTH(somedate) for example than to write cast(DATEADD(DAY,-DATEPART(DAY,somedate),DATEADD(MONTH,1,somedate)) AS DATE).  A developer is unlikely to get an EOMONTH call wrong, and you can't say the same for a construction of the same function from datepart and dateadd.  It's also a lot easier to read  the Eomonth call, to see instantly what it means, and hence to debug and maintain and enhance - so there is a lot of real business value in that function.It would have saved me some pain if my people could have used something like EOMONTH back in the days of SQL Server 2000.  And since we were a shop where the scripting language was JScript not VBA that wasn't because people were converting anything which already used an EOMONTH function.Maybe some of the other functions are a bit useless, though.</description><pubDate>Mon, 21 Jan 2013 07:52:27 GMT</pubDate><dc:creator>L' Eomot Inversé</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Had not heard about this function until now. Like others I assumed they got it right. The question actually pretty much answers itself. The first 3 sets of choices are all pretty much the same thing. If the function got the leap year right or wrong will provide those. The last couple options seemed like a no brainer to me because the implicit date conversion would not be any different in a function than anywhere else and if the conversion had failed none of the rest of the answers would have even been possible. Given that, there were 8 choices and we were told there were 4 possible answers it all came down to a coin-toss...does the function correctly recognize leap years or not.Good question and it is great to learn about new stuff in 2012!!!</description><pubDate>Mon, 21 Jan 2013 07:44:57 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>I'd never heard of this function, so it was good to hear and learn about it. I have never of this function (not even in Excel since I don't use it that much), so much like Koen and Tom I went into this under the impression that they hadn't screwed up a new function to use. Thank you very much for the great question on a new 2012 feature.</description><pubDate>Mon, 21 Jan 2013 07:41:21 GMT</pubDate><dc:creator>Dana Medley</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Sean Pearce (1/21/2013)[/b][hr][quote][b]Stewart "Arturius" Campbell (1/21/2013)[/b][hr]Good qurstion, Ron,Thanks[quote][b]Sean Pearce (1/21/2013)[/b][hr]This question is better suited for www.GeographyCentral.com.How does knowing the last day of February in 2016 have anything to do with SQL Server? I had to check a calendar in order to answer this question, books online was no good here.[/quote]Point of note:The [url=http://support.microsoft.com/kb/179545?wa=wsignin1.0]EOMONTH function in Excel[/url] currently does not recognise leap years. Therefore, if this was an exact copy of the function as used in Excel, it would not work correctly.[/quote]Since when did SQL Server start copying Excel?[/quote]The link you provided says that this was only a problem for century years not divisible by 400 (so 1900, 2100 etc.) So the Excel formula would have given the correct answer to this question.  It also says that the error was fixed in Excel 2000.</description><pubDate>Mon, 21 Jan 2013 05:31:30 GMT</pubDate><dc:creator>david.irvine 7489</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Sean Pearce (1/21/2013)[/b][hr]This question is better suited for www.GeographyCentral.com.How does knowing the last day of February in 2016 have anything to do with SQL Server? I had to check a calendar in order to answer this question, books online was no good here.[/quote]It would be sad if there was ever a book called, "Everything I Needed to Know I Learned in BOL"!</description><pubDate>Mon, 21 Jan 2013 05:14:38 GMT</pubDate><dc:creator>Thomas Abraham</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Good to see another 2012 question.  I hadn't read about Eomonth before, so had to read a BoL page and learn something new.  :cool:It's mildly irritating though, having to work out what days of the week are 29 Feb 2016 and 31 Dec 2016 - the sort of thing that would tempt me to run the code if the version of of SQL Server I have (2008 R2) included Eomonth.  ;-)edit: Like Koen, I assumed that the new function wouldn't be screwed up - after all, the date handling in earler versions recognised leap years OK, why would this new function in 2012 be different?  (I wasn't aware of teh EXCEL function - so maybe that was an easier choice for me than for Koen  :-D).</description><pubDate>Mon, 21 Jan 2013 04:58:29 GMT</pubDate><dc:creator>L' Eomot Inversé</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Hugo Kornelis (1/21/2013)[/b][hr]EOMONTH is one of them, IIF is a very clear example, and I think there were a few more, but I don't have the time to hunt them all down now.[/quote]I listed them at the same time you posted :-D(apparently I do have the time to hunt them all down down :w00t:)Most of the new TSQL functions are usability functions, in the sense that you could achieve the same in earlier versions of SQL Server, but with a more clever use of existing functions, such as dateadd.Notable exceptions are OFFSET and FETCH, and the new windowing functions, which are awesome by the way.</description><pubDate>Mon, 21 Jan 2013 03:25:05 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Sean Pearce (1/21/2013)[/b][hr]Since when did SQL Server start copying Excel?[/quote]It didn't (at least not the buggy version of the code that was distributed in Excel 97 and Excel 98 for Macintosh). But in SQL Server 2012, there are definitely a lot of new function that are totally useless - except if you want to enable an easier transition from VBA and Access SQL to T-SQL. EOMONTH is one of them, IIF is a very clear example, and I think there were a few more, but I don't have the time to hunt them all down now.</description><pubDate>Mon, 21 Jan 2013 02:53:55 GMT</pubDate><dc:creator>Hugo Kornelis</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Sean Pearce (1/21/2013)[/b][hr]Since when did SQL Server start copying Excel?[/quote]Since SQL Server 2012 apparently ;-)Other functions "stolen" from other languages: choose, iif, format and concat</description><pubDate>Mon, 21 Jan 2013 02:53:48 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Stewart "Arturius" Campbell (1/21/2013)[/b][hr]Good qurstion, Ron,Thanks[quote][b]Sean Pearce (1/21/2013)[/b][hr]This question is better suited for www.GeographyCentral.com.How does knowing the last day of February in 2016 have anything to do with SQL Server? I had to check a calendar in order to answer this question, books online was no good here.[/quote]Point of note:The [url=http://support.microsoft.com/kb/179545?wa=wsignin1.0]EOMONTH function in Excel[/url] currently does not recognise leap years. Therefore, if this was an exact copy of the function as used in Excel, it would not work correctly.[/quote]Since when did SQL Server start copying Excel?</description><pubDate>Mon, 21 Jan 2013 02:49:44 GMT</pubDate><dc:creator>Sean Pearce</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Good qurstion, Ron,Thanks[quote][b]Sean Pearce (1/21/2013)[/b][hr]This question is better suited for www.GeographyCentral.com.How does knowing the last day of February in 2016 have anything to do with SQL Server? I had to check a calendar in order to answer this question, books online was no good here.[/quote]Point of note:The [url=http://support.microsoft.com/kb/179545?wa=wsignin1.0]EOMONTH function in Excel[/url] currently does not recognise leap years. Therefore, if this was an exact copy of the function as used in Excel, it would not work correctly.</description><pubDate>Mon, 21 Jan 2013 02:24:24 GMT</pubDate><dc:creator>Stewart "Arturius" Campbell</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>This question is better suited for www.GeographyCentral.com.How does knowing the last day of February in 2016 have anything to do with SQL Server? I had to check a calendar in order to answer this question, books online was no good here.</description><pubDate>Mon, 21 Jan 2013 01:21:23 GMT</pubDate><dc:creator>Sean Pearce</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>;-) good one.(.. i didn't know the existence of EOMONTH till now; and the functions in the SQL mainly turn to pink color font by default, by seeing the T-SQL code initially felt like is this a trick question? and literally did the BOL search and yes.... there you are... :-) and understood that the IFCodes needs updating to the 2012 keywords... :-D )</description><pubDate>Mon, 21 Jan 2013 00:59:05 GMT</pubDate><dc:creator>Raghavendra Mudugal</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>[quote][b]Lokesh Vij (1/20/2013)[/b][hr]Thanks Ron for another one on SS 2012![/quote]+1</description><pubDate>Mon, 21 Jan 2013 00:15:39 GMT</pubDate><dc:creator>rals</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Easy one, thanks :-)I selected the answers one could expect, because it would be pretty sad if they messed up a brand new function :-D</description><pubDate>Mon, 21 Jan 2013 00:12:22 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Thanks Ron .</description><pubDate>Sun, 20 Jan 2013 22:03:05 GMT</pubDate><dc:creator>demonfox</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Thanks Ron for another one on SS 2012!</description><pubDate>Sun, 20 Jan 2013 21:15:47 GMT</pubDate><dc:creator>Lokesh Vij</dc:creator></item><item><title>RE: EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Thanks Ron</description><pubDate>Sun, 20 Jan 2013 12:55:52 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>EOMONTH - 1</title><link>http://www.sqlservercentral.com/Forums/Topic1409270-1222-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/questions/EMONTH/95720/"&gt;EOMONTH - 1&lt;/A&gt;[/B]</description><pubDate>Sun, 20 Jan 2013 05:48:53 GMT</pubDate><dc:creator>bitbucket-25253</dc:creator></item></channel></rss>