all groups > sql server replication > july 2005 >
You're in the

sql server replication

group:

Table relationship problem


Re: Table relationship problem Paul Ibison
7/20/2005 12:00:00 AM
sql server replication: JC,

I'm wondering about other integrity issues here: if a record on the
publisher is deleted and there are different relationships to the article on
the subscriber, wouldn't this cause an error on the subscriber? Or are the
relationships identical to the FK tables and these tables are also
replicated?

Triggers are OK and quick, but I wouldn't use them to maintain archives
based on the production database (if this is the case). If the data change
on the subscriber fails, an error is raised on the publisher's data change,
which you probably won't want. Also, I wouldn't hurt publisher performance
this way. As well as covering these issues, replication also gives you some
degree of control as to when the data is replicated.

Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)



Table relationship problem JC
7/20/2005 2:34:05 AM
I've searched the forum as well as the books I have but haven't found an
answer to this.

I have a table that needs to be replicated to other databases on the same
server.

The subscribing databases has tables that needs to keep relationships to
certain data in the replicated table.
That is, there are columns in the replicated table thats being referenced as
foreign keys by other tables at the subscribers.

This as you all know does not work. The subscriber cannot drop the table and
replace it when it needs to update.

The real problem is that I need these relationships.

Re: Table relationship problem JC
7/20/2005 5:41:02 AM
Thanks.
But what do you think of that solution compared to a trigger just updating
the table at the (subscriber). IYO is one better than the other?

[quoted text, click to view]
Re: Table relationship problem JC
7/20/2005 7:01:05 AM
Relationships are not identical or even similar. But it works to use triggers.

And yes you are right, there is a problem of cascading errors from bottom up
using triggers. That's what made me want another solution.

I will consider your approach of scripting. It seems to me that this is more
for heavy workloads of replication and the trigger approach is more for small
scale replication.

Thanks for your help and input.
// JC

[quoted text, click to view]
Re: Table relationship problem Paul Ibison
7/20/2005 12:23:36 PM
JC,
you can use pre and post-snapshot scripts to drop then recreate the FK
relationships as necessary.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

AddThis Social Bookmark Button