Cannot insert duplicate key row in object <tablename> with unique index

From: Brian Barnes (spamme_at_nospam.com)
Date: 07/01/04


Date: Thu, 1 Jul 2004 14:35:04 +1200

Hi all,
Basically I have 2 tables (tblEntitys and tblEntityDetailsEvent) (well more,
but I get the error with 2 tables) that are related based on a guid. I'm
sure SQL server does not know this (I'm using guids extensively in this
database), and both have a guid and date/time Primary key (as this operates
similar to backing up a database into another database). One table appears
to back up fine, but the second table comes up with this error "Cannot
insert duplicate key row in object tblEntityDetailsEvent with unique index
'tblEntitiestblEntityDetailsEvent'" The date time is set to date.now in the
web service that writes to the SQL server database and therefore there
should be no key collisions (although there will be guids with a number of
dates and dates with a number of guids) - this is shown in the table that
backs up fine.

Basically as this database was upsized (and then a few extra columns (the
datetime column was added) and tables were added) from Access which did have
the relationship stated (I also added a diagram that stated this, and have
since deleted it - now there are no diagrams in SQL Server), is there
something I need to add or delete to ensure that this works? or have I
missed somthing completely.

--
Brian Barnes


Relevant Pages

  • RE: Cannot insert duplicate key row in object <tablename> with unique index
    ... | sure SQL server does not know this (I'm using guids extensively in this ... | similar to backing up a database into another database). ... | insert duplicate key row in object tblEntityDetailsEvent with unique index ...
    (microsoft.public.sqlserver.server)
  • Re: Trying to implent (Joe Celkos) Nested Sets, but need more data columns
    ... If GUIDs are used to identify a record ... They exist only in the current PHYSICAL STORAGE for the database. ... ROWID and other proprietary exposed physical locators are ... physical locator is not an identifier and it has no data integrity. ...
    (microsoft.public.sqlserver.programming)
  • Re: identitycolumn as pk
    ... GUIDS would solve the problem i guess but i see different problems with ... What i want to do is insert the data in the new database ... >> columns as primary keys is a commonly used technique so i bet there must ... Changing the database schema ultimately ...
    (microsoft.public.sqlserver.programming)
  • Re: Use of UNIQUEIDENTIFIER vs IDENTITY for PK with VB.NET/SQL2000
    ... This topic has been done over many times in this newsgroup, ... perform a Google search on this newsgroup & you'll get lots of opinions, ... Another advantage of GUIDs ... orderdetail) at the application layer without round-trips to the database. ...
    (microsoft.public.sqlserver.programming)

Loading