Unable to create index because of duplicate that doesn't exist?

It's not that the index already exists, but that there are duplicate values of the TopicShortName field in the table itself. According to the error message the duplicate value is an empty string (it might just be a facet of posting I guess). Such duplicates prevent the creation of a UNIQUE index.

You could 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.


The duplicate is in your data, try running this query to find it.

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

It's because you have records in the table already that are not unique (by the sounds of it, 2 records with a blank value in the TopicShortName field).

So, it's to do with the data, not the index itself.