Missing PK's after transaction snapshot

  • Using Transaction replication I specifically change the default to "Delete Data" on the subscriber, so as not to get a new copy of the table. (I also use Indentity (not for replication) columns) After the snapshot gets replicated to the subsciber, the PK's on the subscriber tables (that were there) are gone.

  • I would suggest you to manually open the .sch files of the snapshot, to see what is SQL changind when applying the snapshot at the subscriber.

    You can also check the .idx and .bcp files.

  • I have looked at those. All the .sch says is to TRUNCATE the table (as I would expect) and to create the table (with no prior DROP table). So the CREATE table should fail because it already exists.

  • You can manually erase the drop table sentence from the snapshot file, and the snapshot will still apply.

    Are you running any pre and post snapshot scripts?

  • There is no DROP sentence anywhere in .pre .idx or .sch. That's the part I don't understand. The .idx build a CLUSTERED INDEX out of my PK's (in error).There are drop functions and drop views and a commands sp_MSdroparticleconstraints and sp_MSdropfkreferencingarticle which are not documented in .pre.

  • Why don't you alter the publication to let the table unchanged. And you delete the tables at the subscriber, manually before applying the snapshot, or create a pre snapshot scripts, to delete the tables for you?

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

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