Looking for a way to get the date in the format “11/1/2009”, which would be the first sunday of next month. I want to run this query after the first sunday in october to get the first sunday of the upcoming month. What is the best method to accomplish this with a T-SQL query?
Thanks
try this:
EDIT Notes:
The first of next Month is given by the expression:
or by:
which can be modified to give the first of the month two months from now by changing the 1 to a 2:
EDIT: In response to @NissanFan, and @Anthony: to modify this to return the first Monday Tuesday Wednesday, etc, change the value 8 to a 9, 10, 11, etc….