Re: Identity columns

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Hilary Cotter (hilaryk_at_att.net)
Date: 02/28/04


Date: Sat, 28 Feb 2004 15:05:23 -0500

for immediate updating subscribers you don't need the NFR property as MSDTC
will take the insert/update/delete that is made on the subscriber, apply it
on the publisher, and then on the subscriber.

The NFR property is necessary when a replication process is doing inserts on
an identity column and qualifying the columns completely.

For instance consider this table

Create table idTest
(pk int not null identity(1,1) primary key,
charcol char(20)
)

an insert like this

insert into idTest (charcol) values ('test') will work

an insert like this

insert into idTest (pk,charcol) values (1,'test') will not work due to the
qualified identity value (1 in this case).

The problem is that replication processes like transactional replication or
queued updating take an insert like this

insert into idTest (charcol) values ('test')

and when replicating this statement turn it into this

insert into idTest (pk,charcol) values (1,'test')

which fails unless you have the NFR switch.

So if you are doing bi-directional transactional or queued updating this is
a problem. It also fails if you have an identity column existing on a table
you are replicating to on the subscriber.

HTH

"Ralph" <machio@karatekid.com> wrote in message
news:ioCdnY-KRfx276LdRVn-iQ@magma.ca...
> Hello all,
> I'm rather new with replication, and I have a question.
> I am setting up a database (sql 2000) for transactional replication. We
> want it for an immediate failover, in case of disaster on the main db. An
> up to the minute exact copy of the original database is what we need.
I've
> been experimenting with replication with a couple of machines in the
office
> and notice that you can't use Identity columns. Well.. you can if you use
> the "not for replication" flag.. however, we actually do need identity
> coloumns in our database.. the replication goes well.. but of course the
> target database is missing the identity column feature..
> Is there another way? is there something I am missing? or will I have to
go
> through the target database turning on Identity columns after a failure
> happens on the main database?
>
> Thanks! Hope this isn't too cryptic...
>
> ----------------------------------------------------------------
> Craig Farrell
>
> "If at first you don't succeed, then you probably shouldn't try skydiving"
>
>
>



Relevant Pages

  • Re: Transactional Replication and IDENTITY
    ... backup your database and restore it on the subscriber. ... sp_scriptpublicationcustomprocs to generate the replication procs. ... SQL 2000 ENT; SP4. ... replicate the identity column as an identity column. ...
    (microsoft.public.sqlserver.replication)
  • Re: IDENTITY = Yes (NOT FOR REPLICATION) - update error at Subscri
    ... Updates will fail via replication, ... The identity column is specified in the insert and values list of an ... Can I rely on ALL inserts occuring in the SAME order on the subscriber as ...
    (microsoft.public.sqlserver.replication)
  • Re: Identity columns
    ... subscriber machine the column is not marked as an identity column.. ... involved in replication but this means that the column on the subscriber ... (your failover server) ...
    (microsoft.public.sqlserver.replication)
  • Re: Replication as a realtime backup
    ... you should be using the Not For Replication clause on your subscriber ... Replication in general does not degrade performance on the Publisher. ... > 1.Auto-increment identity column causes problem. ... We use backup-restore to setup replication. ...
    (microsoft.public.sqlserver.replication)
  • Re: replicated commands not executed on the subscriber side?
    ... My current environment is the most complex sql server environments in my 10+ ... Unlike the replication procedure when changes made at Subscriber, ...
    (microsoft.public.sqlserver.replication)