I have a table: Sales_Table with columns:
ProductKey Int not null,
UnitPrice decimal 18,2,
SalesAmount decimal 18,2
I am trying to add a primary key to the ProductKey column using alter table
ALTER TABLE SALES_TABLE
ADD PRIMARY KEY (ProductKey)
after I run the code and I get the following error:
Msg 1505, Level 16, State 1, Line 9 The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.Sales_Table' and the index name 'PK__Sales_Ta__A15E99B36F3FE24F'. The duplicate key value is (604).
What can I do to overcome this issue? Thanks in Advance.