I once read somewhere that when you're connected as the owner that permissions don't need to be checked when performing operations.Is this a significant performance gain?
A fun challenge! Here's a solution using a recursive cte:
DECLARE @FirstMonth DATE = GETDATE(); ;WITH [cte] AS ( SELECT DATEFROMPARTS(DATEPART(YEAR,@FirstMonth), DATEPART(MONTH,@FirstMonth), 13) AS [d] -- the 13th for...