title: Addition of total hours in SQL Server
body: <p>In my database, I have a table with a column of type <code>Float</code> which represents the total work hours. I have to sum this value over all rows.</p>
  
  <p>I can't use sum function, because 08.03 = 08 hour, 03 minute.</p>
  
  <p>For example:</p>
  
  <pre><code>00.55 + 00.51=&gt;  01.06
  </code></pre>
  
  <p>but I want </p>
  
  <pre><code>00.55 + 00.51 =&gt;  01.46
  </code></pre>
  
  <p>My query</p>
  
  <pre><code>Declare @TEMP1 table (TotalHours float)
  
  insert into @TEMP1(TotalHours)
      select ol.HrWork TotalHours
      from OTLog ol
      where EmployeeId = 2048
  
  Declare @attCount int
  Declare @attSum int
  set @attSum = 0;
  set @attCount = (select count(*) from @TEMP1)
  
  print @attCount
  
  while (@attCount &lt;&gt; 0)
  begin
      set @attSum =  @attSum + (select Top 1 (LEFT(TotalHours,1)*60)+(RIGHT(TotalHours,2)) TotalHours from @TEMP1);
  
      delete top(1) from @TEMP1;
  
      set @attCount = @attCount - 1;
      print @attSum;
  end
  
  print @attSum
  
  select * 
  from OTLog 
  where EmployeeId = 2048
  </code></pre>
  
  <p>Any thoughts would be appreciated.</p>