2012年3月19日星期一

FK for tables out of the publication.

Hi ,
I would like to know what is the base approach for FK for tables out of the
publication.
I have several situations that I would like to add FK from tables out of
publication ( tables that do not replicate at all – historical tables or
replicate by different publication) to a table in live publication. This
actually can be done, but when I have to initialize the publication and apply
new snapshot the agent will fail because it does not able to drop the table
/delete rows due to the FK. I thought that define the FK as “not for
replication” will solve it but it doesn’t.
I have the problem on SQL 2000 enterprise edition SP3 and SP4.
Eyal
Eyal,
you can use pre-snapshot and post-snapshot scripts to handle FKs outside of
the publication.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||What you need to do is change the article properties to keep the existing
table intact. Right click on your publication, select properties, click on
the articles tab, and then select the snapshot tab, and select keep existing
table unchanged. Note that this might duplicate data, so you may need to use
the delete data option and have cascading deletes on the subscriber.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"? ??" <nospameyalSchapira@.hotmail.com> wrote in message
news:D207B0D7-8ADA-4BB1-98AC-962DE0778AD2@.microsoft.com...
> Hi ,
> I would like to know what is the base approach for FK for tables out of
> the
> publication.
> I have several situations that I would like to add FK from tables out
> of
> publication ( tables that do not replicate at all - historical tables or
> replicate by different publication) to a table in live publication.
> This
> actually can be done, but when I have to initialize the publication and
> apply
> new snapshot the agent will fail because it does not able to drop the
> table
> /delete rows due to the FK. I thought that define the FK as "not for
> replication" will solve it but it doesn't.
> I have the problem on SQL 2000 enterprise edition SP3 and SP4.
> Eyal
>

没有评论:

发表评论