Have a publisher with a specific publication that has 1 article, and 4 subscribers. The subscribers are on 3 separate instances with the the same database name(database1) for 3 of the 4 subscribers. I am having an issue with one table having a foreign key
added to it on the 2 of the subscribers with the same database name as the subscriber where the FK's are being dropped/added correctly via the pre/post snapshot scripts. Prior to the snapshot, the 2 subscriber tables do not have the foreign key, but after
the snapshot, the key is added. The table(s) where the incorrect foreign key is being added is a table that is in another publication and exists on these 2 subscribers with no foreign keys as these are reporting servers. The pre and post snapshot scripts
that run for the publication deletes and recreates many foreign keys in the 3rd subcriber database, and these foreign keys are being dropped and created as expected, but I can't seem to find why these 2 tables are getting the foreign key added. There are 9
other tables involved with foreign keys to the published article, none of them are having a key added on the 2 subscribers, just this one. I have pasted a screen shot of the post snapshot file so you can see the logic used to apply the foreign keys. The 2
subscribers I am having issues with are not in the server list in the first if statement, there names could be server4 and server5. What pointed out this problem, is when I dropped the subscriptions and publication to reapply, I was getting an error
indicating that the foreign key already exists on those 2 subscriber tables which leads to think it is something other than the pre/post scripts. It is odd that this problem foreign key is the very 1st key dropped/created in the pre/post scripts. Also
both of the articles/tables involved here have "copy foreign key constraints" set to false in their article properties on the publications
Thanks for any insight
↧
Foreign keys being created on multiple subscribers
↧