title: Assigning values for [Month] parameter in a stored procedure
body: <p>I have a stored procedure, for which the output is a table with [Year] and [Month] columns along with many other columns. I have also created four parameters as @SYear, @SMonth, @EYear, @EMonth. The distinct of [year] is 2015 and 2016. In the month column I have got few months like 2,3,5,7,8 etc in the year 2015 and 1,2 in the year 2016. Now I want to assign the values from the year and month columns to the parameters. In case of year I was able to assign it as ([Year] Between @SYear and @EYear). But when it comes to month if I assign ([Month] BETWEEN @SMonth AND @EMonth), the problem is practically the 5th month of 2015 is less than 1st month of 2016, but as sql is taking [Month] as integer 5 is greater than 1., so it isn't working. If i select @SYear = 2015, @SMonth = 5, @EYear = 2015, @EMonth = 7 it works.</p>
  
  <p>Please suggest a possible way to assign the month column to the starta nd end month parameters.</p>
  
  <p>BTW @S is start @E is end.</p>
  
  <p>Hope I am clear enough for you guys to understand the problem, please let me know if anyone doesn't understand.</p>
  
  <p>thank you.</p>
  
  <p>Edit:
  <a href="https://i.stack.imgur.com/62tpX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/62tpX.png" alt="enter image description here"></a></p>
  
  <p>Here when I select the start year, start month and end year, end month as parameters I should get the results from the table.</p>