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

Identity Column Management in Replication

$
0
0

I m trying to add one of the tables to existing publication. The table has identity column. I ran the below scripts, but inserts are failing on "cannot insert a value into identity column without specifying set identity insert on" errors. Can someone help me what I m doing wrong here? Its one way transactional replication, no updates at the subsrciber. Version : SQL Server 2008 R2

 Thanks

EXEC sp_addarticle @publication = N'Master_Publication',

             @article = N'TableA',
    @source_owner = N'dbo', @source_object = N'TableA',
    @type = N'logbased', @description = N'', @creation_script = N'',
    @pre_creation_cmd = N'truncate', @schema_option = 0x0000000000030051,
    @identityrangemanagementoption = N'manual',
    @destination_table = N'TableA', @destination_owner = N'dbo',
    @status = 16, @vertical_partition = N'false',
    @ins_cmd = N'SQL', 
    @del_cmd = N'SQL',
    @upd_cmd = N'SQL'
go

exec sp_addsubscription  @publication = 'Master_Publication',
     @article =  'TableA',
     @subscriber = 'SQLServer21',
     @destination_db = 'MasterDB',
     @sync_type =  'automatic',
    @subscription_type = N'Push',
     @update_mode = N'read only',
    @frequency_type = 64, 
    @frequency_interval = 1,
    @frequency_relative_interval = 1, 
    @frequency_recurrence_factor = 0,
    @frequency_subday = 4, 
    @frequency_subday_interval = 5,
    @active_start_time_of_day = 0, 
    @active_end_time_of_day = 235959,
    @active_start_date = 0, 
    @active_end_date = 0, @offloadagent = 0,
    @dts_package_location = N'Distributor'


Viewing all articles
Browse latest Browse all 4054

Trending Articles



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