Transact-SQL Custom Stored Procedure Resolver

Replication Programming

Replication Programming

Transact-SQL Custom Stored Procedure Resolver

The program in the C:\Microsoft SQL Server\80\Tools\Devtools\Samples\sqlrepl\deflt_sp directory is a sample application, which builds a custom stored procedure resolver that executes at the Publisher. The resolver uses the Northwind sample database, a distributed query to obtain information from the Subscriber, and then computes the average price if the values between the Publisher and Subscriber are different. The resolver then makes the average price the resolved value, and logs the conflict at the Publisher so it can be viewed, and if necessary, changed. Finally, the application sends an e-mail stating that the price was changed to an average due to a conflict. If any columns other than price have changed, the resolver uses the values from the Publisher.

The resolver is designed to run on the Products table in Northwind sample database. It is assumed that the sample code was saved to the default directory offered during installation, and that the files can be found in C:\Microsoft SQL Server\80\Tools\Devtools\Samples\sqlrepl\deflt_sp.

Note  To run this sample, two computers are required. For the distributed query to work, the two computers must both be running the Microsoft Windows NT 4.0 or Windows 2000 operating system, or the Publisher must be running on Windows 2000 with the linked server running on Windows NT 4.0.

To run the sample program

  1. On the computer that will be the Publisher, verify that the SQL Server Agent is running. If it is not running, start it.

  2. Using the Create Publication Wizard, create a merge publication based on the Northwind database, and then select the Products table as an article in the publication.

How to create publications and define articles