Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Merge Replication Stored Procedure Custom Resolver

$
0
0
Hi All,

Running SQL Server 2008 R2 in a merge replication topology.  Publisher and distributor are on the same machine.  All subscribers running SQL Server 2008 R2 Express.

I have a requirement to implement a stored procedure custom resolver, however searching BOL and Online has not lead me to any examples of how one would look.  DDL and Sample Data are below.

CREATE TABLE [dbo].[Records](
    [RecordID] [varchar](50) NOT NULL,
    [ValueA] [varchar](50) NULL,
    [ValueB] [varchar](50) NULL,
    [StatusCode] [varchar](50) NULL)
GO

-- Publisher Records Table Data
INSERT INTO [dbo].[Records]
        ([RecordID], [ValueA], [ValueB], [StatusCode])
VALUES
    ('1', 'Tested', 'Fixed', 'S05')

-- Subscriber Records Table Data
INSERT INTO [dbo].[Records]
    ([RecordID], [ValueA], [ValueB], [StatusCode])
VALUES
    ('1', 'Tested', 'Not Good', 'S01')

What I'm looking for is a stored procedure that would resolve the conflict based on the StatusCode.  As an example, the Publisher would win the row conflict because it has a StatusCode of 'S05' or greater, so ValueA would remain as 'Tested' and ValueB would remain as 'Fixed'.  If this is not the case the conflict should resolve itself according to the default resolver.  In addition, if this resolver is placed on an article which has join filters attached to it, will the conflict resolution filter down to these sub-articles?

Any ideas/examples would be greatly appreciated!

Thanks.

Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>