title: Calculate Average of Time(7) in SQL
body: <p>I am making an attendance system in which I will add monthly records of employee time in and time out. At the end of the month average time in and time out will be created. </p>
  
  <p>Please tell me how to apply <code>avg()</code> to datatype of <code>time(7)</code>?</p>
  
  <pre><code>declare @tblPK table
  (
      timeinat varchar(13) not null,
      timeoutat varchar(13) not null
  ) ;
  
  insert into @tblPK 
  select cast((onattendance) as varchar(13))ONTime, 
         cast((offattendance) as varchar(13))OFFTime 
  from t_attendancedetails ;
  
  select * from @tblPK ;
  </code></pre>
  
  <p>This is only giving output of all entries.</p>