title: is this correct this intead of delete trigger? and other questions about tirggers
body: <p>I need to to delete the children of a table when I delete the parent. The common Order/details example.</p>
  
  <p>I use this instead trigger:</p>
  
  <pre><code>CREATE TRIGGER trg_OderDelete
     ON  Oders
     INSTEAD OF DELETE
  AS 
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  
      -- Insert statements for trigger here
      Delete from Details where IDOrder IN(select deleted.IDOrder from deleted)
      Delete from Orders where IDOrder IN(select deleted.IDOrder from deleted)
  END
  GO
  </code></pre>
  
  <p>First, I try with only the fist delete statement, but only delete de details, not the orders, so I added the second delete to delete the order too.</p>
  
  <p>My doubt is if this is correct or not. I mean that if the trigger is executed when I delete an order, why have I to added the delete statement in the trigger to delete the order that execute the trigger?</p>
  
  <p>I also would like to know this:</p>
  
  <p>1.- is a transaction? I mean that if I delete the details and for some reason the order can't be deleted, finally the details are not deleted?</p>
  
  <p>2.- This transaction avoid to added new details when I delete the ordener? Imagine that I want to delete an order, in the trigger is executed the  first delete, the details, but before is executed the second delete, the order, other user try to added a new detail. This detail is added or not because the order is blocked in a transaction?</p>
  
  <p>Thanks.</p>