declare @StartQuarter int declare @StartYear int declare @EndQuarter int declare @EndYear int declare @StartRange int, @EndRange int, @SYear int, @SQuarter int set @SYear=@StartYear set @SQuarter=@StartQuarter ),@SYear)+convert(varchar(),@SQuarter))…