Share via


SQL Server Troubleshooting: Transactional Replication “Cannot insert explicit value for identity column”

Issue

How to add the NOT FOR REPLICATION option to existing tables (IDENTITY column, FOREIGN KEY constraints) in T-SQL?

Source: http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/f142b042-c9c9-49e0-a3d6-a19494fc6046

Solution

Make the triggers on the subscriber not for replication and ensure that the identity column on the subscriber is marked as not for replication. This should take care of the problem:

Alter table  dbo.TableName Alter  column [pkcolumn] add NOT  FOR REPLICATION

Reference

 Source: http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/f142b042-c9c9-49e0-a3d6-a19494fc6046