In a recent post, I wrote how the T-SQL TRIM() function was more than just an LTRIM(RTRIM()) and that it took me a while to realize that. Well today, I found another one that I hadn't noticed before: EOMONTH.
I was writing a SELECT clause for a query, when the Intellisense popped up:
And suddenly I noticed "Param2" and wondered what on earth the second parameter was.
Now you might notice that the Intellisense isn't very helpful on this. It gives you no hint what the parameters are. In fact, for many of the features added to T-SQL in SQL Server 2012, the Intellisense is really poor. Here's another example:
Good luck making sense of that helpful popup.
But a quick check of the T-SQL documentation showed it as an integer that changes which month it's returning values for. It's a number of months to add. That's a nice additional option. I'm surprised I hadn't noticed it before.
So in the main image above, you can see that as well as end of month for the current month when I'm writing this, I've also asked for end of month, three months ago. Nice !