title: Only begin stored procdure if previous value is less than new value being inserted into table SQL Server
body: <p>I have a stored procedure. I only want it to insert new values if the date value is higher than previous record.</p>
  
  <pre><code>Department   Change    Date
  ------------------------------------
  Catering        3      2018-01-01 08:09:00.000   - Current Record 
  
  Department   Change    Date
  -----------------------------------------------
  Catering       3       2018-01-02 09:10:00.000   - New record to be inserted 
  </code></pre>
  
  <p>I have this so far, but obviously the select is wrong. I want to do something like this before the <code>Insert</code> statement</p>
  
  <pre><code> if select top 1 * 
      from  database.[dbo].[DepartmentChange]
      where Department = @Department
        and Date &gt; @Date
      order by Date desc  
  begin 
  </code></pre>
  
  <p>please help</p>