all groups > sql server replication > january 2007 >
You're in the

sql server replication

group:

Changing table properties



Changing table properties David
1/25/2007 9:05:46 AM
sql server replication: I have 7 tables that I want to remove the checkbox for "Enforce relationship
for replication". These tables are all articles in a publication and I want
them to get down to the merge synchronization laptop subscribers. On a test
system, I unchecked them in EM and the changes took without any errors
(actually I expected to be told I cannot do that on published articles). I
assume that I can just re-create the snapshot and have the laptops
"reinitialize" at their next synch. Am I correct or missing anything.
Thanks.

David

Re: Changing table properties David
1/25/2007 1:28:16 PM
I tried this in a test environment but when I looked at the database on the
laptop it still had the box checked. Did I miss something?

David

[quoted text, click to view]

Re: Changing table properties Paul Ibison
1/25/2007 4:39:12 PM
David,
this is fine, although you might be able to just apply a script on the
subscriber to drop the FKs directly (or through sp_addscriptexec) without
doing the reinitialization.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Re: Changing table properties David
1/26/2007 8:41:13 AM
Paul,
I was trying to do it in Enterprise Manager instead of script. I then went
into the Snapshot Agent and restarted the snapshot agent, which I thought
would pick up the new settings. I then re-initialized the subscription at
the laptop but it didn't pick up the removal of "Enforce relationship for
replication".
Do I need to completely re-create the publication? If I can do it in a
script then what script do I use to run on the laptops and where can I find
the syntax for changing this relationship property? Thank you.

David

[quoted text, click to view]

Re: Changing table properties Paul Ibison
1/26/2007 9:54:11 AM
David - can you post up the script you were using and I'll take a look.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .



Re: Changing table properties David
1/26/2007 11:23:19 AM
Also, do I need to run sp_addscriptexec at both the publisher and
subscriber? I read the BOL and they said you have to be sysadmin to run it
but the laptops are not. Thanks.

David

[quoted text, click to view]

Re: Changing table properties Paul Ibison
1/29/2007 9:39:38 AM
David,

the script is in the form:

ALTER TABLE dbo.yourFKtable
DROP CONSTRAINT yourFKtable1
GO

ALTER TABLE dbo.yourFKtable WITH NOCHECK ADD CONSTRAINT
yourFKtable1 FOREIGN KEY
(
PKColumn
) REFERENCES dbo.YourPKTable
(
pkcolumn
) NOT FOR REPLICATION

GO

You'll need to run this at the publisher to change the publisher tables then
add it to the publication using sp_addscriptexec.

Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Re: Changing table properties Paul Ibison
1/29/2007 9:40:15 AM
Hi David - have answered your other thread below.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .

Re: Changing table properties David
1/29/2007 10:28:57 AM
Thanks Paul. Will I have to run sp_addscriptexec at the subscribers also or
will that happen when they synch?
David

[quoted text, click to view]

Re: Changing table properties Paul Ibison
1/29/2007 5:21:26 PM
David - the merge agent will take care of applying it to the subscribers.
Cheers,
Paul Ibison

AddThis Social Bookmark Button