Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 send multiple messages from trigger

Author  Topic 

MCPieters
Starting Member

3 Posts

Posted - 2014-02-26 : 05:04:30
Hi,

I am using service broker to send messages from triggers.
Now when I insert many records at once in the table with the trigger, I want to send the inserted records from trigger in batches.
like I inserted 1 million records and now I want to send these records in batches of 250.000. I tried to use row_number() over() but I get an error, I think I cannot number the records of the table inserted(inside the trigger).

Does anyone has a solution?

Robowski
Posting Yak Master

101 Posts

Posted - 2014-02-27 : 06:39:46
quote:
Originally posted by MCPieters

Hi,

I am using service broker to send messages from triggers.
Now when I insert many records at once in the table with the trigger, I want to send the inserted records from trigger in batches.
like I inserted 1 million records and now I want to send these records in batches of 250.000. I tried to use row_number() over() but I get an error, I think I cannot number the records of the table inserted(inside the trigger).

Does anyone has a solution?



Create a staging table and place the inserted records only in there with an identity column and a second process to take the records from there and send in batches that way?
Go to Top of Page
   

- Advertisement -