Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Btimmerman
Starting Member
2 Posts |
Posted - 2012-06-14 : 17:28:10
|
I'm attempting to repair a sql server instance on our server (new one) after our old one crashed. The program had to be re-installed and authorized with Ser# and AuthCode. After that process the program attempts to make connection to SQL database and allow connection to be made by workstation to server.I receive an error (taken from update.log file):Error! Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server]CREATE UNIQUE INDEX terminated because a duplicate key was found for object name 'dbo.PRWHPLUS' and index name 'pk_PRWHPLUS'. The duplicate key value is (746).DOSQL():ALTER TABLE PRWHPLUS ADD CONSTRAINT pk_PRWHPLUS PRIMARY KEY (nDetailID)When i try to fix the issue and look into the database i find that the database has the primary key already setup, but this part of SQL is beyond me.Any help greatly appreciated.Thanks! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2012-06-14 : 17:38:31
|
The constraint exists, but you've got duplicate data. So you'll need to fix the data before proceeding.Run this to see:select nDetailID, COUNT(*)from PRWHPLUSgroup by nDetailIDhaving COUNT(*) > 1Anything returned by that means a duplicate of nDetailID exists. The second column in the output shows how many there are. You only want 1, and I've excluded anything with just 1 from the output. There are several "deleting duplicates" solutions out there, so you can either google them or search SQLTeam for them.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
|
|
Btimmerman
Starting Member
2 Posts |
Posted - 2012-06-14 : 17:50:01
|
It returns none...Not sure how i can show you that - forum doesn't allow inserting images that i can tell...? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|