I have a merge publication on a SQL Server 2008 instance. The subscription exists on a SQL CE database. Everything works fine, until I try to add replication filters. If I add only one filter to the publication, I can create the subscription just fine. I can also go back and add new filters one-by-one, and everything works. However, if I create more than one filter at a time, no matter how many tables I include in the publication, I get the following error:
TITLE: Microsoft SQL Server Management Studio ------------------------------
The referenced table must have a primary or candidate key. [ FK Name = FK_Residents_ResidentStatus ] HRESULT 0x80004005 (28599) The SQL statement failed to execute. If this occurred while using merge replication, this is an internal error. If this occurred while using RDA, then the SQL statement is invalid either on the PULL statement or on the SubmitSQL statement. [ SQL statement = ALTER TABLE "Residents" ADD CONSTRAINT "FK_Residents_ResidentStatus" FOREIGN KEY ( "ResidentStatusKey" ) REFERENCES "ResidentStatus" ( "ResidentStatusKey" ) ON UPDATE CASCADE ] HRESULT 0x80004005 (28560).
Can someone please advise? I can give more detail if needed. Thanks in advance!