How to generate a merge conflict in a trigger ?
- From: "Josep" <jmartinez@xxxxxxxx>
- Date: Mon, 4 Dec 2006 18:05:29 +0100
Hello,
I would like to be able to generate a conflict for merge replication inside
a trigger.
The problem appears in some tables like 'Customers' where the primary key is
an IDENTITY where in the replication is automatically managed by SQL Server
2000 without any problem. But the application that uses this database uses a
CFI (customer friendly identification) in conjunction with a column that
makes it active or not (for the application), because we cannot delete data
(invoices, etc..) for legal stuff.
But I cannot have two CFI actives.
So I can have in the table the following information:
ID CFI Name Active
2 J2 Johan 0
3 A4 Michel 1
4 J2 Joe 1
But I cannot add:
5 J2 Joanne 1
And I've a TRIGGER to avoid that (although the application still controls
that). But in the replication, there's no conflict but I get this error (I
have translated it, so it might not appear exactly the same in your English
version):
The process cannot give the updates to 'Publisher'.
(Source: Provider of merge replication (Agent); Error number: -2147200989)
---------------------------------------------------------------------------------------------------------------
This error is RAISED by the trigger. You are trying to have two "customer
friendly identification" actives
(Source: INDRA\SQLSERVER2000 (Data source); Error number: 50000)
---------------------------------------------------------------------------------------------------------------
In this case I've made the changes to the Subscriber and is the publisher
that fires the trigger. But the same happens if I make the change in the
Publisher.
That makes the agent fail and I don't get any conflict to resolve (that's
what I would like). So can I generate a conflict in the trigger or there are
other ways to solve this kind of problems?
Thank you for your help,
Josep Martínez
.
- Follow-Ups:
- Prev by Date: Re: Temporarily blocking merge agents...
- Next by Date: Re: How to generate a merge conflict in a trigger ?
- Previous by thread: Re: SQL2005 Merge Conflicts Gumming Performance
- Next by thread: Re: How to generate a merge conflict in a trigger ?
- Index(es):
Relevant Pages
|