Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
IntegrityError: UNIQUE constraint failed: ACTOR.aid


I was inserting entries into a table name as ACTOR by a python program which is giving above error. How to remove this error?


What I have tried:

I have tried to figure out why this error is coming but failed thats why asking. How to remove this error?
Posted
Updated 3-Jun-20 4:44am
Comments
F-ES Sitecore 3-Jun-20 10:16am    
Don't add duplicate aid values in the actor table.

1 solution

The value of aid that you are trying to insert into the table ACTOR already exists on that table, and the column has a UNIQUE constraint on it.
Either remove the UNIQUE constraint (probably not the right solution) OR check for whether you should be updating an existing row or inserting a new one.

We cannot make that decision for you, nor can we help much beyond this unless you actually share more details of your code and database

Here are some references that may help:
Create Unique Constraints - SQL Server | Microsoft Docs[^]
Unique Constraints and Check Constraints - SQL Server | Microsoft Docs[^]
An Essential Guide to SQL Server UNIQUE Constraint[^]

As you have tagged Jupyter you might get more information from there - see Project Jupyter | Home[^]
 
Share this answer
 
Comments
A. B. Dinshaa 4-Jun-20 3:47am    
This error was coming on spyder IDE not on jupyter notebook so I stopped using spyder IDE the only problem is jupyter is giving any output at all which I am trying to figure out and if I required I am going to disturb you later for the above mentioned purpose.
Secondly jupyter is considered as better and latest as it is browser based and everything is getting browser based fast.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900