title: Performing date/time subtraction in SQL Server
body: <p>I have four columns in a table:</p>
  <pre><code>date entered, time entered, date completed, time completed
  </code></pre>
  <p>I would like to know the difference between date/time ENTERED and date/time COMPLETED</p>
  <p>For example</p>
  <pre><code>date entered = 1/1/2001
  time entered = 10:00
  time completed = 1/2/2001
  time completed = 11:00
  </code></pre>
  <p>The difference is 25 hours.</p>
  <p>How can I perform this computation with a select statement?</p>
  <p>I tried this:</p>
  <pre><code>DATEDIFF(hh,dateadd(hh,[Time Entered],[Date Entered]),dateadd(hh,[Time Completed],[Date Completed]) ) AS [Hours]
  </code></pre>
  <p>and got the following error:</p>
  <blockquote>
  <p>Msg 8116, Level 16, State 1, Line 2<br>
  Argument data type time is invalid for argument 2 of dateadd function.</p>
  </blockquote>