• Register
1 vote
51 views

Problem :

I am facing bellow error
the create unique index statement terminated because a duplicate key was found for the object name
6.9k points

1 Answer

0 votes

Solution :

The problem is not that index already exists but there are duplicate values of the TopicShortName field in the table itself. Such duplicates prevent the creation of a UNIQUE index.

So you should run a query to confirm that you have a duplicate:

SELECT
    TopicShortName,
    COUNT(*)
FROM
    DimMeasureTopic
GROUP BY
    TopicShortName
HAVING
    COUNT(*) > 1

Presumably in the other database the data are different, and the duplicates are not present.

This will certainly solve your problem.

Further Readings :

https://www.ibm.com/support/pages/refresh-fails-create-unique-index-statement-terminated-because-duplicate-key-was-found-error-while-replicating-sql-server-target

36.1k points

Related questions

1 vote
2 answers 28 views
28 views
Problem : I am very new to database programming. I have recently started learning about databases. Currently I am desperately trying to create the database somehow for a very first time. I have already designed all of my tables. Now I am trying to create their relationships. But ... till now unable to fix it. So I am looking for database expert who can suggest me the quick fix for my above error.
asked Apr 22 stewart 4k points
0 votes
2 answers 121 views
121 views
Problem : I want to import the flat file into my oledb target sql server database. But I am getting below error message : [Source - 18942979103_txt [424]] Error: Data conversion failed. The data conversion for column "recipient-name" returned status value 4 and status text ... more characters had no match in the target code page.". Why am I getting this error message? What am I doing wrong here?
asked Dec 23, 2019 alecxe 7.5k points
1 vote
1 answer 25 views
25 views
Problem : I am very new to SQL. If I try to use the sp_executesq I am often facing below strange looking error: “Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.” I have spent more than two days on above error but still can not fix above sql related error. Please guide me in fixing above sql error.
asked May 12 Martin K 6.6k points
0 votes
1 answer 25 views
25 views
Problem : I was getting the following error when running a SQL the conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 8 views