Archive

Posts Tagged ‘replication’

Not for replication

August 24, 2009 Rafat Sarosh Leave a comment

If you have a database which is replicated, then run the following query on the publisher and if you get any result back then you got some work at your hand

select distinct t.[name], c.* from sys.tables t
    join sys.columns c on t.object_id = c.object_id
             and c.is_identity = 1 and c.is_replicated = 0

this query basically tells that you have tables which have identity columns but they are not created with ‘NOT FOR REPLICATION’ option.

If that is the case then your identity columns are out of synch between publisher and subscriber. You can fix it by setting the is_replicated column to 1.

EXEC %%
ColumnEx(
ObjectID = @
object_id,
Name = @
identity_column).
SetIdentityNotForRepl(VALUE = 1)
Categories: SQL Tags: ,