hi,
we have problem that on replicated DB foreign keys are set as not_for_replication = 1. That leads to another problem, that these keys are not trusted. We need trusted keys, so we need use FK for replication (aka set not_for_replication = 0)
we create replication by t-sql functions.
In function sp_addarticle is possibility to set various flags in parameter schema_option. We are using flag 0x0000000008007FDF. From documentation it seems that parameter responsible for setting flag not_for_replication is
0x20000 | Replicates FOREIGN KEY constraints as NOT FOR REPLICATION so that the constraints are not enforced during synchronization. |
This flag is set to 0 in 0x0000000008007FDF.
Despite this fact, FK are still set not_for_replication=1 (tried also default value 0x30F3 with same result)
Another way how to make FK trusted is drop them and recreate, but it is not possible due to large DB (last toooo long)
So, please do you know someone why FK are still set not_for_replication=1 even if proper schema_option is used ?
Are we missing something ?
Thank you very much for any help.