There may be a more elegant way to remove this, but below works.
Declare @dt datetime = GETDATE() SELECT LEFT('0' + CAST(MONTH(@dt) as varchar(2)),2) + '-' + CAST(YEAR(@dt) as char(4))
btw is my regular cheat for converting dates here , but I don't see MM-YYYY as one of the formats.
source share