Calculate the Last Day of the Month in T-SQL
Suppose you’d like to select rows in an Salesforce Marketing Cloud data extension created on the last day of the month. Here’s what I use:
The last portion of the where clause finds the first day of the next month and then subtracts one day.
Normally queries like this run in a daily automation.
For further reading: