title: SQL Server trigger delete or cascade delete
body: <p>First off I haven't done much SQL code before only the basic CRUD, but I'm involved in a project in which I have access to SQL Server and its up to me to write the SQL.</p>
  
  <p>I've been busy looking on stackoverflow for a solution but (being new) it does not make any sense to me.</p>
  
  <p>I'm using SQL Server 2012.</p>
  
  <p>I have the following relationship (with foreign key constraints in place)</p>
  
  <pre><code>Client &gt; Order &gt; OrderItems
  </code></pre>
  
  <p><strong>Order</strong></p>
  
  <pre><code>Id
  ClientId
  </code></pre>
  
  <p><strong>OrderItems</strong></p>
  
  <pre><code>Id
  OrderId
  </code></pre>
  
  <p>I'm using EF and when I call my delete method on client I need to delete all the the related items in <code>orders</code> and <code>orderitems</code> tables</p>
  
  <p>I need to add a trigger to go and delete <code>orders</code> and <code>orderitems</code>, but I'm not sure how to do this or if a cascade delete (I've heard of) is best?</p>
  
  <p>Anyone have a quick example and advice of how to do this?</p>