Strange!
Setting up plain transactional replication on Northwind, and after failover,
sure enough the next identity value is wrong (still 1), causing a primary key
violation.
However, running DBCC CHECKIDENT ('Categories',RESEED) does indeed do a
re-seed, even with Not For Replication set, contrary to what BOL says. This
then allows inserts into the table, and gets the next identity value.
To do this on all tables:
--Generate a query that can be used to reseed all tables
SELECT 'DBCC CHECKIDENT ('''+ O.name +''',RESEED)'
from sysobjects O
INNER JOIN syscolumns C on O.id = C.id
WHERE o.type='U' AND objectproperty (o.id, 'TABLEHASIDENTITY') = 1
AND columnproperty (o.id, c.name, 'IsIdentity') = 1
ORDER BY O.name
Result:
DBCC CHECKIDENT ('Categories',RESEED)
DBCC CHECKIDENT ('dtproperties',RESEED)
DBCC CHECKIDENT ('Employees',RESEED)
....etc...
Copy & paste the result into query analyser and execute, to re-seed all
tables.
Regards,
Andy Mackie.
[quoted text, click to view] Paul Ibison wrote:
> Andy,
> in straightforward transactional replication, the identity attribute isn't
> transferred at all to the subscriber. If you have it there through eg a
> nosync initialization, DBCC CHECKIDENT can indeed be used to reseed - BOL
> has an error in this regard, which I've logged. However this is a manual
> process. The easiest way to have it all work simply is to use queued
> updating subscribers and drop the replication settings on failover.
> Rgds,
> Paul Ibison SQL Server MVP,
www.replicationanswers.com > (recommended sql server 2000 replication book:
>
http://www.nwsu.com/0974973602p.html)