title: Trigger that updates just the inserted row
body: <p>I'm trying to create a simple trigger using TSQL (or SQL Server 2008). The problem is: my current trigger is updating the entire table. This was fine for a while, but now the table has more than 20k rows. So I want a trigger that only updates the rows that are being inserted. </p>
  
  <p>Here's my current simple trigger:</p>
  
  <pre><code>CREATE TRIGGER trig_MyPplUpdate
  ON [Persons]
  FOR INSERT
  AS
  Begin
   Update Persons
      set MyFile = NULL
      where Len(MyFile) &lt; 60
  End
  </code></pre>
  
  <p>I think I'll have to use either the "inserted" table or the <code>row_number</code> function ordered by the primary key. Any ideas?</p>