title: Operand data type time is invalid for subtract operator
body: <p>I am having an issue where this code is not working for me. It was, and everything is correct as far as I can tell, but I keep getting an error for the line. I understand that this is a duplicate of other questions, and I have searched through them, but nothing has worked for me</p>
  
  <pre><code>convert(time(0),(isnull(solver_endtime,'')-isnull(solver_starttime,''))) as solverruntime,
  </code></pre>
  
  <p>Here is the entire code in case I missed something</p>
  
  <pre><code>IF OBJECT_ID('staging.dbo.Log_Batch_Report_2', 'U') IS NOT NULL
  merge into staging.dbo.log_batch_report_2 a
  using 
  (select batch,
      starttime,
      endtime,
      convert(time(0),(isnull(endtime,'')-isnull(starttime,''))) as totalruntime,
      convert(time(0),(isnull(solver_endtime,'')-isnull(solver_starttime,''))) as solverruntime,
      convert(time(0),((isnull(endtime,'')-isnull(starttime,''))- (isnull(solver_endtime,'')-isnull(solver_starttime,'')))) as non_solverruntime,
      to_time
  from staging.dbo.log_batch_report
  ) b
  on a.batch=b.batch and a.starttime=b.starttime and a.endtime=b.endtime
  when matched then update set a.batch=a.batch
  when not matched then insert (batch,batchdate,logility_up_time,starttime,endtime,totalruntime,solverruntime)
  values (b.batch,b.starttime,b.endtime,b.starttime,b.endtime,b.totalruntime,b.solverruntime);
  </code></pre>
  
  <p>EDIT</p>
  
  <p>This is what I get from the totalruntime line in this code. What is the difference between that and the other two lines?</p>
  
  <p><a href="https://i.stack.imgur.com/nSYNr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nSYNr.png" alt="enter image description here"></a></p>