title: Get Data between two months with different years in SQL
body: <p>I got a table in sql server which has several fields including expYear in int, expMonth in int. </p>
  
  <p>I am writing a SP to retrieve data between two months. which i can do by  <code>(expMonth between @M1 and @M2) AND @currentYear=expYear</code>  if both M1 and M2 in the same <code>expYear</code>.</p>
  
  <p>But <code>if my M1=11(december)</code> which is in the year 2016 <code>and M2=2(february)</code> which is in the year 2017 then it doesn't work.</p>
  
  <p>Could anyone tell what to do? Please remember, in DB both <code>"expYear "</code> and <code>"expMonth "</code> value are stored as int. even <code>"@M1"</code>, <code>"@M2"</code>, <code>"@currentYear"</code> all are coming from back end as int. </p>