transaction replication

  • Both the Publisher & Subscriber are in synchronized state but 1 particular row is missed (in Subscriber server) which is recently updated..... hoe can i get it?

  • So you're saying there is a missing row on the subscriber and you want to insert it?

    There are a couple of ways. Probably the easiest is to create an insert statement and run it on the subscriber.

    An alternative which I prefer is to edit the sp_MSupd_tablename proc on the subscriber to have an if exists statement as in below and update all columns on the subscriber to the same value (SET columnA = columnA)

    This would work on the same table in the future too.

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER procedure [dbo].[sp_MSupd_Title]

    @c1 int,@c2 varchar(50),@c3 int,@pkc1 int

    ,@bitmap binary(1)

    as

    if exists (select * from title where id = @pkc1)

    begin

    if substring(@bitmap,1,1) & 1 = 1

    begin

    update "Title" set

    "ID" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "ID" end

    ,"Name" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Name" end

    ,"DisplayOrder" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "DisplayOrder" end

    where "ID" = @pkc1

    if @@rowcount = 0

    if @@microsoftversion>0x07320000

    exec sp_MSreplraiserror 20598

    end

    else

    begin

    update "Title" set

    "Name" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "Name" end

    ,"DisplayOrder" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "DisplayOrder" end

    where "ID" = @pkc1

    if @@rowcount = 0

    if @@microsoftversion>0x07320000

    exec sp_MSreplraiserror 20598

    end

    end

    else

    begin

    insert into Title (ID, Name, DisplayOrder)

    values (@c1, @c2, @c3)

    end

    GO

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply