Home > Archive > MS SQL Server > March 2006 > Replication and User Defined Trigger









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Replication and User Defined Trigger
rockdale.green@gmail.com

2006-03-26, 8:23 pm

Hi, all:

We have 5 databases which contains invoice and invoiceHistory tables.

We have an update and insert trigger on invoice table to record every
modification into InvoiceHistory table. The invoiceHistory table is not

read only, it has some fields that the end user can edit (comments,
date ...etc). At the same time, we using scheduled snapshots every 5
minutes to 'refresh' the table at the suscribers. The problem is when
the replicate server replicate table invoice to a subscribe, the
trigger on invoice table will be triggered and update/insert
InvoiceHistory table in the subscribe. Then when the replicate server
replicate table InvoiceHistory, we will get duplicate record in
InvoiceTable, one is from Invoice table trigger and another is from
InvoiceHistory replicate.


If we do not replicate InvoiceHistory table, then those fields that end

user updated can not be sync to subscribes.

Can I disable the trigger on invoice table when replication?

Does anybody there have a better idea how to do something like this?


Thanks

MC

2006-03-27, 3:23 am

Check for the NOT FOR REPLICATION option. If you put it, trigger will not be
fired for replication.


MC


<rockdale.green@gmail.com> wrote in message
news:1143418413.367012.182670@v46g2000cwv.googlegroups.com...
> Hi, all:
>
> We have 5 databases which contains invoice and invoiceHistory tables.
>
> We have an update and insert trigger on invoice table to record every
> modification into InvoiceHistory table. The invoiceHistory table is not
>
> read only, it has some fields that the end user can edit (comments,
> date ...etc). At the same time, we using scheduled snapshots every 5
> minutes to 'refresh' the table at the suscribers. The problem is when
> the replicate server replicate table invoice to a subscribe, the
> trigger on invoice table will be triggered and update/insert
> InvoiceHistory table in the subscribe. Then when the replicate server
> replicate table InvoiceHistory, we will get duplicate record in
> InvoiceTable, one is from Invoice table trigger and another is from
> InvoiceHistory replicate.
>
>
> If we do not replicate InvoiceHistory table, then those fields that end
>
> user updated can not be sync to subscribes.
>
> Can I disable the trigger on invoice table when replication?
>
> Does anybody there have a better idea how to do something like this?
>
>
> Thanks
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com