Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Article with a filter: Instead of updating, it is deleting rows at subscriber

$
0
0
EXEC sp_addarticle @publication = N'Sales_db__TranRepl', @article = N'DummyTable'
, @source_owner = N'dbo', @source_object = N'DummyTable', @type = N'logbased', @description = N''
, @creation_script = N'', @pre_creation_cmd = N'delete'
, @schema_option = 0x000000000803509F, @identityrangemanagementoption = N'manual'
, @destination_table = N'DummyTable', @destination_owner = N'dbo'
, @status = 24, @vertical_partition = N'false', @ins_cmd = N'CALL [dbo].[sp_MSins_dboDummyTable]'
, @del_cmd = N'CALL [dbo].[sp_MSdel_dboDummyTable]', @upd_cmd = N'SCALL [dbo].[sp_MSupd_dboDummyTable]'
, @filter_clause = N'[Delete_date] IS NULL'
GO
-- Adding the article filter
EXEC SP_ARTICLEFILTER @publication = N'Sales_db__TranRepl', @article = N'DummyTable'
, @filter_name = N'FLTR_DummyTable_1__91', @filter_clause = N'[Delete_date] IS NULL'
, @force_invalidate_snapshot = 1, @force_reinit_subscription = 1
-- Adding the article synchronization object
EXEC sp_articleview @publication = N'Sales_db__TranRepl', @article = N'DummyTable'
, @view_name = N'SYNC_DummyTable_1__91', @filter_clause = N'[Delete_date] IS NULL'
, @force_invalidate_snapshot = 1, @force_reinit_subscription = 1
GO

Env details:

SQL SERVER 2008 R2 for both publisher and subscriber.
Both are ent edition.
Article in question has a filter at column Delete_date which is a date column (NOT datetime, date only)



All inserts, deletes and updates are running fine
Except:
When for the article, I am trying to update the value of column Delete_date for a record from Null to a date value, lets say 2013-06-12, it is deleting that record from the subscriber.
I verified and found that the replication sp is fired the moment I am updating the column value on which filter is defined.
This looks strange to me.

My requirement is that:
when the column Delete_date has a value of not null, it must not be processed by replication.
So in the above example when I am putting a value to  the column Delete_date for a record, it should be ignored by replication (No effect at the subscriber).

Please help. In case I need to furnish more details, please let me know.


Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>