Update statement as below works fine when executed on publisher db where as the record gets deleted from the subscriber after replicating:
DECLARE @Temp12 table (code NVARCHAR(50),EmpID UNIQUEIDENTIFIER)
Insert into @Temp12 values ('123345','<GUID>')
UPDATE E
SET E.Empcode = temp.code
FROM Employee E
INNER JOIN @Temp12 temp ON temp.ParcelID = E.EmpID
WHERE E.EmpID = temp.EmpID
However, a simple update statement like the one below works fine and does not delete records from the Subscriber db when executed on publisher db:
UPDATE Employee SET Empcode = '12345'
WHERE EmpID = '<GUID>'
Note : EmpCode column has a unique key constraint
Would like to know the reason behind this behaviour in SQL replication. Thanks.
Tried testing both the updates mentioned above and only 2nd update i.e. without temp variable is working fine.