looping through inserted table in trigger

  • What's the best way to loop through an inserted table. I have to send an MSMQ message for each row. I have the MSMQ part but the only way I know to loop through the inserted table is with a cursor which I would like to avoid.

    Thanks.

  • Have a look about midway down this forum.

    http://www.sqlservercentral.com/forum/link.asp?TOPIC_ID=10401

    Crispin

    Why don't you try practicing random acts of intelligence and senseless acts of self-control?

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • Thanks. It worked well.

  • Cool. Question though.

    What table did you use? Variable or TempDB.

    Did you try both and compare?

    Just curious.

    Cheers,

    Crispin

    Why don't you try practicing random acts of intelligence and senseless acts of self-control?

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • I went with the variable.

    Do I need to destroy the var when exiting the trigger or will it destroy itself when it goes out of scope?

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply