We're working with simple queries, not stored procedures, so you don't have the "just assign it to a variable and calculate from there" option.
From some quick Googling, it's not horribly difficult to calculate the second Tuesday of a given month. Most of the examples I found were the same and were examples of how to do it in Excel, but we can work with that.
Example (
source😞=DATE(@year, @month, 1+7*n) - WEEKDAY(DATE(@year, @month, 8-xday))
where '
xday' is the day of the week we're after (1=Sun, 2=Mon, 3=Tue, ...) and '
n' is the nth instance of that day in the month.
For the second Tueday, then, n=2 and xday=3
=DATE(@year, @month, 1+7*2)-WEEKDAY(DATE(@year, @month, 8-3))
We don't have the =Date(yyyy, mm, dd) function to work with, so I'll refer back to
CONVERT(DateTime, CONVERT(VarChar(50), (@Year*10000 + @Month*100 + @Day)), 112)
Likewise, we can't just subtract a number from a date like Excel, so we'll need to use
DateDiff(dd, -1*days, basedate)
If I haven't mangled things, this should be the second Tuesday of next month:
DateAdd(dd,
-1*DatePart(dw, CONVERT(DateTime, CONVERT(VarChar(50), (DatePart(yyyy, DateAdd(mm, 1, GetDate()))*10000 + DatePart(mm, DateAdd(mm, 1, GetDate()))*100 + 8-3)), 112) ),
CONVERT(DateTime, CONVERT(VarChar(50), (DatePart(yyyy, DateAdd(mm, 1, GetDate()))*10000 + DatePart(mm, DateAdd(mm, 1, GetDate()))*100 + 1+7*2)), 112)
)
I Googled up a few examples that did essentially the same thing but generalized it by creating a function. Assuming you want to keep your "report" (query) self-contained, this should do the job.