Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Snapshot alters my forgien keys.

11 views
Skip to first unread message

David Roussel

unread,
Aug 20, 2002, 6:11:43 AM8/20/02
to
I have a transactional replication set. My snapshot is configured to
'delete the existing data that matched the row filter', I've also tried the
truncate option too. However what I don't want is to delete the tables and
add them again. The reason I didn't want to do this is that I have other
tables that foreign key to the replicated data. So if the tables were
dropped I'd lose all my existing relationships.

What I have found is that even if I choose not to drop the tables, the
snapshot removes all foreign key anyway!

In the snapshot.pre file the stored proc sp_MSdroparticleconstraints is run
against each table. This stored proc drops all constraints (unique
constraint, primary key, foreign keys, check constraints) from the tables.

I had realised earilier that something funy was going on with my foreign
keys and wrote a pair of scripts to run before and after the snapshot to
drop and then add again, all foreign keys to the subscription tables. Now
I've goint to have to modifiy it for all constaints too.

Why does SQL Server do this? Surely BCP can insert if there is a constaint?
Is there any way to turn this behaviour off?

Thanks

Dave


Raj Gill

unread,
Aug 20, 2002, 12:27:39 PM8/20/02
to
Did you have the 'Include declared referential integrity' option for the snapshot checked at some  point?
 
rgill
 
"David Roussel" <diro...@hotmail.com> wrote in message news:O0LCeHDSCHA.4200@tkmsftngp09...

David Roussel

unread,
Aug 20, 2002, 12:51:51 PM8/20/02
to
Yes, Raj, I did have the 'Include referential integrity'. I've since unset
it for reasons I can't remember (like getting my script that addes the FKs
back to work).

So if I don't set this option sp_MSdroparticleconstraints will not be
called?

If I uncheck the option in the GUI, then the 'Nonclustered indexes' option
can't be unchecked. If I'm supplying my own indexes before applying the
snapshot, then I'd like none of these options. Can I just pass 0 as the
schema_option parameter to sp_addarticle?

Thanks for the hint.

Dave

"Raj Gill" <gillra...@hotmail.com> wrote in message
news:u0Wo3ZGSCHA.1792@tkmsftngp13...

Zarko Jovanovic

unread,
Aug 21, 2002, 1:50:36 AM8/21/02
to
AFAIK you can set a script to run imediate after snapshot

"David Roussel" <diro...@hotmail.com> wrote in message
news:upX7BnGSCHA.1820@tkmsftngp13...
0 new messages