Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Losing Primary Key when Replicating

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-01-23 : 08:33:57
Dani writes "I have created an archive database that looks exactly the same as my production OLTP database. I have set up a replication model to drop data into the archive database on a daily basis. I am currently using snapshot replication for some of the more static tables and transactional replication for some other tables. My replication is working exactly as intended, however, I keep losing the primary keys in my archive database. I am using SQL 2000 with the default article options as drop and recreate destination tables. My OLTP database has the primary keys so I don't understand why I keep losing them."

KnooKie
Aged Yak Warrior

623 Posts

Posted - 2003-01-23 : 09:01:05
hi dani

you don't need to create the archive database as the replication process will create it for you. It is standard that primary keys are removed during replication (not sure about merge though?) to ensure relational integrity in your data i.e. only users at the publisher end can change data. You could happily use transactional replication for all of it as only changed/added/deleted records will be replicated thus static tables will remain the same anyway.

If you wish to use your archive database you could copy changed records to it as you see fit but would have to code this in triggers or some such fashion.

===========
Paul
Go to Top of Page
   

- Advertisement -