DECLARE @Date DATE = '2/28/2014'
I need to test whether the DAY in the DATE above is the LAST day of the month and it should work for all months in the year.
If it's true, then I need to return a true, if not, then false.
E.g.
SET @Date = '2/27/2014'
This should return FALSE.
SET @Date = '12/31/2014'
This should return TRUE.
I know you can manipulate this based on month but I'm just wondering whether there is an easy way to do it.
An easy way that works in almost any version of SQL Server is:
That is, add a day and see if you are in the same month. This works for leap years, and Dec 31 and so on.