title: SqL stored procedure to find the dates,month and days
body: <p>In SQL Server how to write the query to get the month in between the startdate and enddate, days(in month) for the Month , actual number of days in the month</p>
  
  <p>startdate and enddate is passed as a input parameter , i need to know the number of months, actual days and the count of days in the month</p>
  
  <p>e.g :</p>
  
  <pre><code>Start date : 2012-04-02
  End date :   2012-08-23
  </code></pre>
  
  <p>i need to get the result as,</p>
  
  <pre><code>Month      Days     ActualDays _ inMonth    
  ----------------------------------------------
  04         29       30   - (The no of days on Apr'12 )
  05         31       31    
  06         31       31    
  07         31       31    
  08         31       31
  </code></pre>
  
  <p>04  -month<br>
  29 -(Frm startdate 2-Apr to till 30-Apr'12(Apr End))<br>
  30   - (The no of days on Apr'12 )</p>