Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

Order of replicated commands from Publisher to Subscriber in Transactional replication sql server 2012

$
0
0

In Transactional replication the order of the commands execution in Subscriber is not same as it is in Publisher.

I have a table Which have foreign key reference to its own table column.

Alter Table [dbo].[test1] With Check Add CONSTRAINT [FK_TEST_PARENTTESTID] FOREIGN KEY([ParenttestID])

REFRENCES [dbo].[test]([ID])
GO

ALTER TABLE [dbo].[TEST] CHECK CONSTRAINT  [FK_TEST_PARENTTESTID]

So in publisher first base row was inserted and then other rows referenced to that base rows were inserted.

But in subscriber the order was not same as in publisher. So I got following error in replication
'insert statement conflicted with the foreign key same table constraint'

I solved this by adding 'Not For Replication' for the constraint. But i have many tables which have Foreign key same table constraint. I am afraid I might have error related to this in future on replication.

Can some one help me on this??


Viewing all articles
Browse latest Browse all 17268

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>