title: Adding Days To Date in SQL
body: <p>I am trying to get data from my Database of those who have upcoming birth days in next few days(declared earlier)
  it's working fine for days but this query will not work if i add 24 days to current date cause than it will need change in month.
  i wonder how can i do it</p>
  
  <pre><code>    declare @date int=10,
  @month int=0
  select * from STUDENT_INFO where DATEPART(DD,STDNT_DOB) between 
  DATEPART(DD,GETDATE()) and  DATEPART(DD,DATEADD(DD,@date,GETDATE()))
  and
  DATEPART(MM,STDNT_DOB) = DATEPART(MM,DATEADD(MM,@month,GETDATE()))
  </code></pre>
  
  <p>This query works fine but it only checks date between 8 &amp; 18</p>
  
  <p>but if i use it like this </p>
  
  <pre><code>declare @date int=30,
  @month int=0
  select * from STUDENT_INFO where DATEPART(DD,STDNT_DOB) between 
  DATEPART(DD,GETDATE()) and  DATEPART(DD,DATEADD(DD,@date,GETDATE()))
  and
  DATEPART(MM,STDNT_DOB) = DATEPART(MM,DATEADD(MM,@month,GETDATE()))
  </code></pre>
  
  <p>it will return nothing since it require addition in month as well</p>
  
  <p>If I Use it like this</p>
  
  <pre><code>declare @date int=40,
  @month int=0
  select * from STUDENT_INFO where DATEPART(DD,STDNT_DOB) between 
  DATEPART(DD,GETDATE()) and  DATEADD(DD,@date,GETDATE())
  and
  DATEPART(MM,STDNT_DOB) = DATEPART(MM,DATEADD(MM,@month,GETDATE()))
  </code></pre>
  
  <p>than it will return results till the last of this month but will not show till 18/12 which was required </p>