title: Work out person age in months sql
body: <p>Using the below as a basis how would i work out a person age in months i not to sure how to go about changing this so the months is cacualated instead of years</p>
  
  <pre><code>          IF cast(datepart(m, GETDATE()) as int) &gt; cast(datepart(m,@in_DOB) as int)
      SET @age = cast(datediff(yyyy,@in_DOB,GETDATE()) as int)
        else
      IF cast(datepart(m,GETDATE()) as int) = cast(datepart(m,@in_DOB) as int)
  
      IF datepart(d,GETDATE()) &gt;= datepart(d,@in_DOB)
  
      SET @age = cast(datediff(yyyy,@in_DOB,GETDATE()) as int)
  
      ELSE
  
      SET @age = cast(datediff(yyyy,@in_DOB,GETDATE()) as int) -1
  
      ELSE
  
      SET @age = cast(datediff(yyyy,@in_DOB,GETDATE()) as int) - 1
  
      RETURN @age
  </code></pre>