Violation of PRIMARY KEY

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
Post Reply
Tomis
Posts: 4
Joined: Thu 10 Sep 2015 11:00

Violation of PRIMARY KEY

Post by Tomis » Thu 10 Sep 2015 11:27

Hi

I have used this datasync to sync two tables to the server. It has worked ok until now:

Violation of PRIMARY KEY constraint 'PK__ReportDa__3214EC271D4CF30A'. Cannot insert duplicate key in object 'dbo.ReportData'. The duplicate key value is (20150811131154).

If I clear the table data from server side I can sync it once (all data) but not after that.
What could it be because it has worked before with filter timestamp > GETDATE()-30

Tomis
Posts: 4
Joined: Thu 10 Sep 2015 11:00

Re: Violation of PRIMARY KEY

Post by Tomis » Fri 11 Sep 2015 06:53

It seems that timestamp > GETDATE()-30 is not working.

Two tables are connected with FK so when table1 is inserted one row,table 2 gets 5 rows with same ID.
Perhaps there has been writing in 0:00 or something which get the error.

Data in tables are not changing there is only new lines. How can I filter that so that I wouldn't need to compare the whole data??

alexa

Re: Violation of PRIMARY KEY

Post by alexa » Fri 11 Sep 2015 14:45

Could you please let us know what version of dbForge you are using?

Tomis
Posts: 4
Joined: Thu 10 Sep 2015 11:00

Re: Violation of PRIMARY KEY

Post by Tomis » Tue 22 Sep 2015 06:06

3.8.265
I had a update windows but I think I dont have username or password.

Is there possibilty to let program just increase rows but not change anyting?

I will try this: Timestamp>CONVERT(VARCHAR(10),GETDATE()-30,112)

alexa

Re: Violation of PRIMARY KEY

Post by alexa » Tue 22 Sep 2015 09:31

We will review this post and will answer you as soon as possible.

alexa

Re: Violation of PRIMARY KEY

Post by alexa » Wed 23 Sep 2015 14:10

Could you please send us the CREATE definitions for table1 and table2 on Source and Target and a couple of records (INSERT statements) for the tables?

You can send a reply straight to our support system at supportATdevartDOTcom

Post Reply