title: Subtract two dates in Microsoft SQL Server
body: <p>I want to subtract 2 dates in MS SQL Server.</p>
  
  <p>Example: </p>
  
  <pre><code>Current date      Last used date
  '2016-03-30'      '2015-02-03'
  </code></pre>
  
  <p>Current date refers to today's date, "Last used date" is a measure.</p>
  
  <p>How to write a query in SQL Server?</p>
  
  <p>I have this but doesn't work (it says "Operand data type is invalid for subtract operator")</p>
  
  <pre><code>select 
      CONVERT(DATE, GETDATE()) - CONVERT(DATE, LastUsedDate) 
  from 
      databasename 
  </code></pre>