Quantcast
Channel: StackExchange Replication Questions
Viewing all articles
Browse latest Browse all 17268

increment id on subscriber in sql server replication

$
0
0

I am trying to replicate a table that has identity column, and a guid

Replication Type: Transactional Push

TableA (guid uniqueidentifier, id identity(1,1) not null)

  • I want the identity to increment at the subscriber in the below case case 1: when a new insert comes from a replication agent The issue I have is the identity is not incrementing as the replication agent sets (NOT FOR REPLICATION) is not appropriate solution for me, as I would need reverse of NOT FOR REPLCATION.

  • I have tried changing the id column to INT instead of identity and place a trigger on the column to increment, that does not work too.

  • I have also tried custom stored procedure @schema_opton =0x02 , but my stored procedure is being modified by replication agent to default procedure

Please let me know for any suggestions.

Example expected output:

when publisher1 publishes to subscriber TableA at Publisher1 --- GUID1 1 TableA at Subscriber --- GUID1 1

when publisher2 also publishes to subscriber TableA at Publisher2 --- GUID2 2 TableA at Subscriber

                     
                           GUID1 1
                           GUID2 2
                     

  

Example current output:

when publisher1 publishes to subscriber

  1. TableA at Publisher1 --- GUID1 1
  2. TableA at Subscriber --- GUID1 1

when publisher2 also publishes to subscriber

  1. TableA at Publisher2 --- GUID2 2
  2. TableA at Subscriber ---

                     
                           GUID1 1
                           GUID2 1
                     
    
    

Viewing all articles
Browse latest Browse all 17268

Trending Articles



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