SQL Server Performance

Trigger - INSERT SELECT

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by condeba92, Jul 12, 2007.

  1. condeba92 New Member

    Dear friends, i need to know how i have to do to execute a trigger 'n' times when a execute a command line like this:

    insert table1
    select * from table2

    I this kind of command line, the table1 trigger execute just one time, but insert 'n' rows in table1 table.

    When i execute the following command, the table1 trigger executes 'n' times:
    ...
    while @i<=@n
    begin
    insert table1(field1,field2) values(value1,value2)
    select @i=@i+1
    end
    ...
    Thank's

  2. MohammedU New Member

    You want to fire a trigger 'n' times when you insert a single row into trigger table?


    MohammedU.
    Microsoft SQL Server MVP
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
  3. Madhivanan Moderator

  4. satya Moderator

    THis thread is locked as you have further clues from Frank over there.


    Satya SKJ
    Microsoft SQL Server MVP
    Writer, Contributing Editor & Moderator
    http://www.SQL-Server-Performance.Com
    @http://www.askasqlguru.com/

    This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.

Share This Page