web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

(0) ShareShare
ReportReport
Posted on by 414

Hi All,

please can you advise.

I am having issue.

here is what happened

  1. I had custom data entity called 'CAPSALESINVOICELINEMARGIN'
  2. I have extended this data entity to make more change. extended data entity is named as 'CAPSALESINVOICELINEMARGIN.CAPEXTENSION'
  3. I have then included staging table 'CAPSALESINVOICELINEMARGINSTAGING' of original data entity to new extended project.
  4. I have deleted 'CAPSALESINVOICELINEMARGINSTAGING' table from project (clicked delete table permanently to yes)
  5. Performed build
  6. I am now trying to recreate data entity from scratch but getting error as below

7701.Err.JPG

I have the same question (0)
  • YOG Profile Picture
    414 on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    Sure Nikoloas,

    Thanks for your help.

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    This is a completely new problem, I suggest you post it as new question.

    When posting, please provide a bit more information about your environment (is it MS managed, Cloud hosted, or local VM). This way others can start providing help right away.

    Also could you please close this discussion by marking the relevant answer(s) as verified. Thanks!

  • YOG Profile Picture
    414 on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    Hi Nikolaos/Willi,

    I have deleted table and done build too.

    I have created new entity from scratch but I am now unable to export data and instead getting error as below.

    3581.Err.JPG

    I can see services are disable but i cannot find option to unable it. is there any way?

    6661.Err2.JPG

  • YOG Profile Picture
    414 on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    hi Nikolaos,

    thank you . i'll try this.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    You can delete any object by adding it to Visual Studio project and deleting it.

    I thought you said you already deleted it. But you also said that you recreated it :) So please delete it, sync db and then try to recreate it.

  • YOG Profile Picture
    414 on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    hi Will,

    I can see staging table in AOT.

    how can i delete it?

  • Verified answer
    WillWU Profile Picture
    22,359 on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    Hi YOG,

    Make sure the table CAPSALESINVOICELINEMARGINSTAGING does not exist in AOT.

    Please synchronize the DB and try it again.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name xxxx

    Your steps seem very strange.

    If you want to add fields to an entity using extension, you have to extend the entity and the staging table. But if you developed the original entity, you don't need to extend it, just add your fields directly in the original entity and staging table!

    Why did you delete the staging table? Anyway, after deleting the table, please perform DB sync before attempting to create it again.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 745 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 597 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 580 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans