SQL Server Performance Forum – Threads Archive
Trans. Replication and Primary KeysI have a couple of tables a developer created that need to be added to replication. When attempting it returns an error saying that the table can not be replicated because it doesn’t have a Primary Key. Is it true that PKs are required for transactional replication or is there another way around it?
Generally speaking, in an RDBMS all tables should have a PK. There is no strict requirement, but PKs are the best kind of foundation to have.
But, are PKs required for the table to be part of transactional replication?
quote:Originally posted by Adriaan Generally speaking, in an RDBMS all tables should have a PK. There is no strict requirement, but PKs are the best kind of foundation to have.
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/tranrepl.mspx fyi. Satya SKJ
Microsoft SQL Server MVP
Contributing Editor & Forums Moderator
This posting is provided â€œAS ISâ€ with no rights for the sake of knowledge sharing.
But can you tell me the reason that what are the requirement of primary key in transactional replication in sql server.
Transactional Replication mechanism uses PK to identify the rows modified (inserted/updated/deleted).
After seting up replication, you can check at the subscriber database. snapshot agent would have created 3 stored prcoedures (one for each operation) to insert the row to the table. Especially the update/delete procedures use PK.