title: Adding time in SQL Server 2008
body: <p>I want to add time in SQL Server. I have a column called <code>checktime</code> in the database which is a <code>datetime</code> datatype. I want to add the time from the column <code>checktime</code>. How can I do this ??</p>
  
  <p>I'm doing this calculation for calculating total hrs an employee has worked during a specified day.</p>
  
  <p>My database look like this.. I want to add  the time from <code>checktime</code> where <code>checktype = 1</code> and <code>checktype = 2</code> and then subtract the results.
  (checktype = 1 means check in and checktype = 2 means check out)</p>
  
  <p>How can I do this??</p>
  
  <pre><code>  Id        EmpId              CheckTime                                CheckType
  ---------------------------------------------------------------------------------
    3           5             2013-01-03 09:00:15.000                         1 
    4           5             2013-01-03 11:00:00.000                         2 
    5           5             2013-01-03 11:30:00.000                         1 
    6           5             2013-01-03 13:00:00.000                         2 
    7           5             2013-01-03 13:30:00.000                         1 
    8           5             2013-01-03 16:00:00.000                         2 
    9           5             2013-01-03 16:30:00.000                         1 
   10           5             2013-01-03 18:00:00.000                         2 
  </code></pre>