title: Create trigger on SQL Server table
body: <p>I want to create a trigger on a SQL Server table. </p>
  
  <p>Table has 8 columns. One of them is <code>email</code>. i.e. <code>peter@msn.com</code></p>
  
  <p>What I want is: when a new row is inserted into the table, the trigger should update my <code>ISP</code> column with <code>msn.com</code></p>
  
  <pre><code>  CREATE TRIGGER TIGUPDATEISP ON SUBS
    FOR INSERT
    AS 
       UPDATE SUBS 
       SET ISP = SELECT RIGHT(EMAIL, LEN(EMAIL) - CHARINDEX('@', EMAIL) FROM INSERTED)
  </code></pre>
  
  <p>This is updating all my <code>isp</code> with the last value. However, I wanted to update  one as per insert. </p>