Wednesday, March 28, 2012

Replication error

Type Replication: Merge
Type Suscriber: Pull
1 Server Publication
5 server Suscriber's
after a reinicialition on one Server suscriber, all data from Publisher was
transfer to the suscriber, but once I trie to insert records, send this error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY
constraint 'PK_table'. Cannot insert duplicate key in object 'table'
I made that before with another Server and nothing happend, wthas wrong on
this one, please help...thanks
Manuel,
is 'PK_table' the table you are replicating? My guess is that you have a
Primary Key that useds the identity attribute and haven't allocated an
identity range (automatic or manual). If this is the case you'll need to
reinitialize. If not, please post up the table schema with PKs.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||CREATE TABLE [SOPV_OMovCuenta] (
[intOMovCuenta_ID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[intCPuntoVenta_ID] [int] NOT NULL ,
[chvOCuenta_ID] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[chvTipoMovCuenta] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[dtmFecha] [datetime] NOT NULL ,
[intResponsable_ID] [int] NOT NULL ,
[chvDocReferencia] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[dtmSumarizado] [datetime] NULL ,
[chvUdf] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[chvRegEstatus] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[chvCreadoPor] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[dtmCreado] [datetime] NOT NULL ,
[chvModificadoPor] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[dtmModificado] [datetime] NOT NULL ,
[unqReplica] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT
[DF_SOPV_OMovCuenta_unqReplica] DEFAULT (newid()),
CONSTRAINT [PK_SOPV_DMovNeg] PRIMARY KEY CLUSTERED
(
[intCPuntoVenta_ID],
[intOMovCuenta_ID]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY]
GO
here, but it happend in all tables, so I think the problem is with the PK,
so I need to reset all identity range in all tables?
"Paul Ibison" escribió:

> Manuel,
> is 'PK_table' the table you are replicating? My guess is that you have a
> Primary Key that useds the identity attribute and haven't allocated an
> identity range (automatic or manual). If this is the case you'll need to
> reinitialize. If not, please post up the table schema with PKs.
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>
|||CREATE TABLE [SOPV_OMovCuenta] (
[intOMovCuenta_ID] [int] IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL ,
[intCPuntoVenta_ID] [int] NOT NULL ,
[chvOCuenta_ID] [varchar] (16) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[chvTipoMovCuenta] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[dtmFecha] [datetime] NOT NULL ,
[intResponsable_ID] [int] NOT NULL ,
[chvDocReferencia] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[dtmSumarizado] [datetime] NULL ,
[chvUdf] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[chvRegEstatus] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[chvCreadoPor] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[dtmCreado] [datetime] NOT NULL ,
[chvModificadoPor] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[dtmModificado] [datetime] NOT NULL ,
[unqReplica] uniqueidentifier ROWGUIDCOL NOT NULL CONSTRAINT
[DF_SOPV_OMovCuenta_unqReplica] DEFAULT (newid()),
CONSTRAINT [PK_SOPV_DMovNeg] PRIMARY KEY CLUSTERED
(
[intCPuntoVenta_ID],
[intOMovCuenta_ID]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY]
GO
here...see I thin that the PK range in not the problem, because happend with
all my tables...
"Paul Ibison" escribió:

> Manuel,
> is 'PK_table' the table you are replicating? My guess is that you have a
> Primary Key that useds the identity attribute and haven't allocated an
> identity range (automatic or manual). If this is the case you'll need to
> reinitialize. If not, please post up the table schema with PKs.
> Rgds,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>
|||Manuel,
this PK has 2 cols, one of which has an identity attribute. Are you using
automatic or manual range management?
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

No comments:

Post a Comment