title: How to break Monthly Budget by each day SQL Server 2012
body: <pre><code>DECLARE @TempTable TABLE 
              (
                  Amount MONEY, 
                  InsurType VARCHAR(100), 
                  MonthNumber INT, 
                  PostDate DATETIME, 
                  DaysInMonth INT
              )
  
  INSERT INTO @TempTable 
  VALUES (2019317, 'Commercial Auto', 1, '2018-01-01 00:00:00.000', 31),
         (3757832, 'Commercial Auto', 2, '2018-01-01 00:00:00.000', 28),
         (5010746, 'Commercial Auto', 3, '2018-01-01 00:00:00.000', 31),
         (4461429.66, 'Commercial Auto', 4, '2018-01-01 00:00:00.000', 30),
         (4049404.44, 'Commercial Auto', 5, '2018-01-01 00:00:00.000', 31)
  
  SELECT * FROM @TempTable 
  </code></pre>
  
  <p>Result looks like that:</p>
  
  <p><a href="https://i.stack.imgur.com/p7fSy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p7fSy.png" alt="enter image description here"></a></p>
  
  <p>Is it possible to break down the amount by each day of the month for all 5 months?</p>
  
  <p>For example the <code>Amount</code> for <code>MonthNumber</code> 1 is = $2,019,317 / 31 = $65,139 per day. </p>
  
  <p>The output should look like this:</p>
  
  <p><a href="https://i.stack.imgur.com/rNQsy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rNQsy.png" alt="enter image description here"></a></p>