Using the DATEADD and DATEDIFF functions, it's possible to return the last date of a month.
SELECT DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, '2016-09-23') + 1, 0))
-- 2016-09-30 00:00:00.000
SQL Server 2012
The EOMONTH function provides a more concise way to return the last date of a month, and...