I have a problem with my transactional replication when I use articles filters and delete operation. When I insert the new data into the publisher all the data that meet the specified filter is inserted to the subscriber - everything works fine. When I delete some data from the publisher not all data that meet the specified filter is deleted from the subscriber and I don't know why.
I have three servers:
A - publisher (Microsoft SQL Server 2012),
B - distributor (Microsoft SQL Server 2012),
C - subscriber (Microsoft SQL Server 2012).
There are six tables in my publisher database. Each table has primary key and some of them have foreign key as shown in the attached picture:
Only the first manufacturer (manufacturer ID=1) data I want to replicate from the publisher to the subscriber, so I use these filters:
SELECT<published_columns>FROM [dbo].[Manufacturer]
WHERE [dbo].[Manufacturer].IDIN(Select M.IDfrom [dbo].[Manufacturer]AS M where M.ID= 1)
SELECT<published_columns>FROM [dbo].[Catalog]
WHERE [dbo].[Catalog].IDIN(Select C.IDfrom [dbo].[Catalog]AS C
INNERJOIN [dbo].[Manufacturer]AS M ON M.ID= C.MID where M.ID = 1)
SELECT<published_columns>FROM [dbo].[Cars]
WHERE IDIN(Select CA.IDfrom [dbo].[Cars]AS CA
INNERJOIN [dbo].[Catalog]AS C ON C.ID= CA.CID
INNERJOIN [dbo].[Manufacturer]AS M ON M.ID= C.MID where M.ID = 1)
SELECT<published_columns>FROM [dbo].[CarParts]
WHERE IDIN(Select CP.IDfrom [dbo].[CarParts]AS CP
INNERJOIN [dbo].[Cars]AS CA ON CA.ID= CP.CarID
INNERJOIN [dbo].[Catalog]AS C ON C.ID= CA.CID
INNERJOIN [dbo].[Manufacturer]AS M ON M.ID= C.MID where M.ID = 1)
SELECT<published_columns>FROM [dbo].[Parts]
WHERE IDIN(Select P.IDfrom [dbo].[Parts]AS P
INNERJOIN [dbo].[CarParts]AS CP ON CP.PID= P.ID
INNERJOIN [dbo].[Cars]AS CA ON CA.ID= CP.CarID
INNERJOIN [dbo].[Catalog]AS C ON C.ID= CA.CID
INNERJOIN [dbo].[Manufacturer]AS M ON M.ID= C.MID where M.ID = 1)
SELECT<published_columns>FROM [dbo].[PartDetails]
WHERE IDIN(Select PD.IDfrom [dbo].[PartDetails]AS PD
INNERJOIN [dbo].[Parts]AS P ON P.ID= PD.PartID
INNERJOIN [dbo].[CarParts]AS CP ON CP.PID= P.ID
INNERJOIN [dbo].[Cars]AS CA ON CA.ID= CP.CarID
INNERJOIN [dbo].[Catalog]AS C ON C.ID= CA.CID
INNERJOIN [dbo].[Manufacturer]AS M ON M.ID= C.MID where M.ID = 1)
When I insertthe new data into the publisher CarParts table, Parts table or PartDetails table all the data that meet the specified filter(manufacturer ID=1) is inserted to the subscriber.
When I deletedata from the publisher CarParts table, Parts table or PartDetails table not all data that meet the specified filter(manufacturer ID=1) is deleted from the subscriber - only deletes data from CarParts table, but not from Parts table and PartDetails table.
The same filter is used for insert and delete operations.Where could be the problem? Maybe it is Microsoft SQL Server 2012 Bug?