I want to select a range of data from today until the last 15th (so this month or last month). How would this be done in TSQL?
Following Get last Friday's Date unless today is Friday using T-SQL it seems like I would have to make use of DATEDIFF at the least.
I’m considering building a date string, like:
set @date='yyyy-mm-15'
But yyyy or mm would not be able to be simply the current year/month, in case it has to look back a month/year.
This should give you what you want
EDIT
changed WHEN DAY(getdate()) > 15 to WHEN DAY(getdate()) < 15, as the results were inverted 🙂