using triggers to keep all versions of rows after update, delete + replication
clients use merge replication (pull or push) replicate data.
of tables contain information should never erased.
versions of row such table should stored, somewhere in database.
means updates , deletes rows should result in in 2 affected rows:
• copy of row before change
• row containing change (or deletion of row in question)
plan achieve using after update,delete triggers on tables "versioning" required.
old versions of row may stored in same database, other database (or database on linked server).
hoping creating not replication triggers on published database.
theory was:
update , delete queries performed against subscribed database should replicated (for concurrency) publisher.
when updates , deletes replicated, triggers on published database fired, updating table containing version rows.
there seem 2 problems approach:
1/
update query against table of subscriber wil result in mupltiple update queries performed against published database during replication.
merge triggers seem generate multiple update statements.
2/
multiple updates of same row in subsciber database not result in correct versioning. end-result appears replicated. (this unexpected because of 'first publisher wins' rule).
right now, seems have create versioning triggers on subscribers , on publisher. , keep diffirent versions of rows in same database source database, maintability (database structure changes 2-4 times year).
anyway... since requirement (keep versions of rows of table) seems guys may have implemented... curious how guys this.
thoughts, tips, .... appreciated.
thx
first if use not for replication trigger on publisher wouldn't fire @ replicated data data directly inputed on publisher.
if you use not replication on both subscriber , publisher achive goal table in store version of rows shold replicated if want version persist on publishers (and subscribers). in case versions applied ones @ source (you can store source database in row table , should implement row version numbering because row can change on each location). problem in situation of conflict because conflict resolution wouldn't loged directly.you should in conflict resolver.
second approach use change data capture options but availabe in enterprise, developer , evaluation versions. change data capture save data required.
SQL Server > SQL Server Replication
Comments
Post a Comment