title: Sql Server trigger not executing for multiple rows
body: <p>I am trying to insert rows into table by selecting rows from other table. The table has trigger which processes all rows inserted using cursor. but when I execute insert, it only processes 1 row while multiple rows has been inserted. Here is the code I have right now. Am I missing something?</p>
  
  <pre><code>    INSERT INTO &lt;table&gt;(&lt;columns&gt;) VALUES
      SELECT &lt;columns&gt;
      FROM &lt;table&gt; WHERE &lt;condition&gt; ORDER BY &lt;column&gt;
  
  
      ALTER TRIGGER &lt;trgName&gt;
      ON &lt;table&gt;
      AFTER INSERT
      AS
      BEGIN
  
     declare cur_inserted cursor for select &lt;col1&gt;,&lt;col2&gt; from inserted
     open cur_inserted
  
     fetch next from cur_inserted into @var1,@var2
     while @@fetch_status = 0
     begin
  
         ---- LOGIC to process each row here
  
     fetch next from cur_inserted into @schedule_nbr,@stn_cd
     end
  
     close cur_inserted
      deallocate cur_inserted
   END
  </code></pre>
  
  <p>Thanks,</p>
  
  <p>Jignesh</p>