Sqlexception duplicate key. The duplicate key value is (Poles, DBO).

Contribute to the Help Center

Submit translations, corrections, and suggestions on GitHub, or reach out on our Community forums.

Note The index is not unique index and allows duplicates. Select(p => p. ,},{Class=0,Number=3621,State=0,Message=The statement has been terminated. MyVal = S. ProxyCreationEnabled is set to true as default. Cannot insert duplicate Sep 25, 2012 · SqlException: Cannot insert duplicate key row in object with unique index. Sep 16, 2013 · I thought MERGE was an atomic insert/update operation, but running a test with multiple threads calling my sproc doing upsert I am running into duplicate key constraint violation, the sproc is not all that difficult. The duplicate key value is (0). ,B = @val2. *ls' with unique index '%. Feb 8, 2022 · If you are still having issues, here is an example to try using LocalDb . com と Mar 10, 2021 · Cannot insert duplicate key in object 'SalesLT. OSUSR_6SL_RIDER' with unique index 'OSIDX_OSUSR_6SL_RIDER_4NAME'. SQLException: Duplicate entry for key when trying to insert in database from java 0 Cannot insert duplicate key row in object with unique index The duplicate key value SQL Server Aug 2, 2013 · There is no unique key index on the field that I can tell (using squirrel). 6. Challenge'. Courses'. Model: Dec 2, 2022 · See the inner exception for details. 다음 쿼리를 실행했더니 에러가 난다. However, if I run it again I get the exception. エラーが発生しました: duplicate key value violates unique constraint "users_email_key". 7. parameters. It allows you to catch types exceptions like this: using (var demoContext = new DemoContext()) {. Даниил Лукьянов. create database Interview_Questions CREATE TABLE Coding_Interview ( employee_id INT NOT NULL, first_name VARCHAR(30 Apr 5, 2013 · SqlException: Cannot insert duplicate key row in object 'dbo. Solved! Go to Solution. SqlException: Cannot insert duplicate key row in object 'dbo. Users'. return e. Jun 17, 2010 · Go to the server explorer. Cannot insert duplicate key in object 'dbo. Data. May 25, 2011 · 2627 happens for a constraint violation (Primary Key). I have entity Stock that has relation one-to-many with Transaction - one Stock can be related with many Transaction s. Attributes' with unique index 'IX_AttributeName'. 10. Items. Especially since you might be able to send all the (StripeTransferId, State) pairs to the database in one call using a Table-Valued parameter , JSON , XML, or Mar 26, 2014 · Cannot insert duplicate key in object 'dbo. {. Jan 28, 2020 · The duplicate key value is (1) Thanks in advance. Tenant = cachedTenant; DbContext. IdentityUser'. Scroll the properties window until you reach "identity specification". The duplicate key value is (1003, 3). Number 2601 and 2627 to catch primary key/unique key constraint violations: 2601: Cannot insert duplicate key row in object '%. It looks like EFCore is inserting them in the join table without checking if they already exist. Exception {System. Difference between "Cannot insert duplicate key row in object" vs "Violation of UNIQUE What you have to do is 1) remove the primary key or 2) change the columns that make up the key so that the rows are truly unique. SQLEXCEPTION: Shorthand for the class of SQLSTATE values that do not begin with '00', '01', or '02'. Dec 18, 2015 · @User - all I meant was that I can't think of anything else that will complain about duplicate keys, but the message is unfortunately parameterized on the type of constraint. _DbContext. So you cannot add more emails called "email". Email == email). Change this to "yes" (you can set the increment / seed to whatever you wish. The problem is that you model object are using singular name (Pupil) convention, while in your database you are using pluralized names Pupils with s. : Error: Microsoft. Try querying your table to check if you already have that record. In your example to produce keys 4, 5, 6: insert into A (id,Name) select ti. SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_BookTag'. Could not create constraint or index. 2) We did calculations on that data 3) We stored that data in ArrayLists and calculated average, maximums, and minimums 4) We created tables (as shown above) and stored data in those tables via SQL 5) We're now integrating the Java application and tables Nov 7, 2023 · The duplicate key value is (ddc9205d-aa3c-479d-9217-01c3404a4c61). The duplicate key value is (PWATERTMP100 , 006, Y, 01). Dec 31, 2012 · AFAIK, the only way to tell a duplicate key exception apart is to parse the error message. To check this, open the table in Design and select "Manage Indexes and Keys" option. context. Configuration. id >= 1 AND ti. Feb 24, 2021 · See the inner exception for details. TargetInvocationException: Exception has been thrown by the target of an invocation. In this tip, we will demo a replication failure caused by a duplication in a unique index of a replicated table. The duplicate key value is (1d262e43-b9b6-4752-9c79-95d955d460ab). Cannot insert duplicate key in object 'prdct_mst_tab'. ON T. I am trying to add multiple roles for single users and in my database table AspNetRoles, I use unique RoleNameIndex key. In addition, both sides of the many-to-many relationship are configured using the HasOne, WithMany and HasForeignKey Fluent API methods. The statement has been terminated. Apr 30, 2016 · I want to tell the user that a record was not deleted because it has child data, but how can I be sure that the exception was thrown because of a foreign key violation? I see that there a sqlexception class that is used for all sql exception. Navigate to the relevant table. SQLException: Cannot insert duplicate key row in object 'dbo. Usually 1,1 is fine). Groups. Entity. Net, C# Etiquetada como duplicate key row, EntityFramework, sql server Publicado por Gustavo Sánchez Soy especialista en escribir software de calidad. The duplicate key value is (1, [email protected] ). SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK__oem_cata__3214EC07DA410015'. Cause. But everytime an exception is raised. Infrastructure. The duplicate key value is (<column A>, <column B>, <column C>). Jul 13, 2017 · The first time I add a migration my seeding works. Cannot insert duplicate key in object 'IDMaster'. sf_geo_locations' with Dec 16, 2018 · 25 8. Find(new Models. MembershipTypes'. AspNetRoles' with unique index 'RoleNameIndex'. AC_Shipping_Addresses'. TournamentUser'. Oct 3, 2017 · When I run the following script, which has run successfully for me on a number of other tables I get the following error: Violation of UNIQUE KEY constraint 'versions_uk'. Linq. 2627: Violation of %ls constraint '%. You need to adjust the ID of the rows you are inserting. I get Cannot insert duplicate key row in object 'dbo. 就会遇到“Duplicate foreign key constraint”(重复外键约束)的错误,因为products表已经有了一个指向categories表的外键关系。 解决重复外键约束 方法一:删除已有的外键约束. var checkModels = member. The duplicate key value is (stock1). 0. In UpdateBook () I see the book has tags, as expected. g. To find out what you rows are duplicate, you could remove: CONSTRAINT idxPRODUCTIVITY_PK PRIMARY KEY NONCLUSTERED (DeptIndex, CMS_Login, CMS_Date)); Import the text file and then run this SELECT statement: The duplicate key value is (0, <the value>). Have tried by dropping constraint and changing size of data type char(20) to char(30) as there are dependencies on table. User'. ERROR [HY000] [Informix][Informix ODBC Driver][Informix]ISAM error: duplicate value for a record with unique key. Where(p => p. you have columns a b c (where a and b are keys) with data 1 2 3 you can not have another set of data 1 Oct 15, 2020 · "Violation of PRIMARY KEY constraint 'mytable_PK'. specially because your ID is identity (When column a is identity it means it is auto-increment field). SQLException: Duplicate entry 'sd' for key 'PRIMARY' 6. TopicShortName. ' which I think covers me in either case. EF doesn't care which unique index, unique constraint, or Primary Key constraint you use for the entity key. The primary key is a logical construct that enforces uniqueness I am trying to run the following query: update OAR. The duplicate key value is (+1, 11111) This is happening inconsistent with about 40 times out of 1000 times. Given you have not posted a minimal reproducible example, we cannot help you because we don't know the definition of your tables and their constraints, nor do we know the data you're trying to insert nor the data already present in your database May 15, 2021 · The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo. DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN -- body of handler END; For information about how the server chooses handlers when a condition occurs, see Section 15. Jul 11, 2018 · That way if a duplicate is about to be added I can let them know and fix it appropriately. StudentCourses'. Duplicate key value: (0c7a0cdc-a7ba-4cf8-ade2-0cef44761597). A better solution is to prevent the duplicate key exception in the first place. The duplicate key value is (1, 1). The ID column being populated by the IDENTITY column is a surrogate key that is being used as the primary index. SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_TournamentUser'. SqlException} Apr 30, 2022 · asked Apr 30, 2022 at 18:00. Violation of PRIMARY KEY constraint 'PK_AC_Shipping_Addresses'. 결국 Jun 18, 2019 · A bug in UPDATE statement or data is causing an actual duplicate violation on the primary key, but some obscure SQL Server bug is resulting in and error message that cites the wrong index name. The solution is to mark one side as 'mappedby' the May 7, 2019 · An unhandled exception occurred while processing the request. but I am getting the error: Cannot insert duplicate key row in object 'OAR. Select the index/key listed and check the appropriate Yes/No drop down for the "Is Unique" property. Most examples I've seen query the database to obtain an instance of an entity, modify some of the instance's properties, and then update it. "} When debugging, I noticed that the Person object, has the Title object saved within it and the Title object again has the Person object in it. Feb 4, 2021 · The primary key for the join table is a composite key comprising both of the foreign key values. Any suggestions would help. ---> Microsoft. Dec 25, 2018 · Advitalitum changed the title Violation of PRIMARY KEY constraint 'PK_Courses'. oem_catalog'. The duplicate key value is (2). ** I tried different manners with more context. Mar 14, 2021 · Microsoft. Completed_orders'. SqlException (0x80131904): Violation of PRIMARY KEY "PK_Users" constraint. Feb 15, 2002 · So for my primary key column generated off the sequence I declare as follows: final String generatedColumns[] = { "ID" }; I then pass the array into my prepareStatement() call inside the createPreparedStatement() method of the PreparedStatementCreator anonymous inner class: Oct 23, 2020 · Publicada en . 1) You can simply not do this, make sure you dont add duplicate PK data. I did a little more research and according to sys. COUNT(*) > 1. DuplicateKeyException: Insert of '539436841-9096b244-0d59-64a1-8efa-ff0000ca1aa5' failed: Telerik. UserID). The duplicate key value is (25309587). Resolution. In fact it is in the second row of the result. 1 java. Company with unique index 'IX_Company_Name'. The duplicate key value is (165863). table1' with unique index 'ix_mobile'. SaveChanges(); Entityframework sees the Tenant as a new tenant (not being tracked), therefor causing Mar 13, 2024 · Solution. It will result in slow indexing and searching since its a varchar and can be long. cs model is a foreign key to the OrderLine table which looks like this: public class OrderLine { public int Id { get; set; } public int OrderID { get; set; } public int ProductId { get; set; } public int Quantity { get; set; } } How do I fix this? Dec 18, 2015 · When I try to create a new rider with the same name and different Route and bus Id. Right-click "Open Table Definition". from A ti. This is sufficient if you want to access Sol Zone data via the Sol or Zone entities. id<=3. It goes on and on. . DbUpdateException' occurred in EntityFramework. Or use a Raw SQL Query to perform the update, which is probably your best bet. Users_tbl. public class VersionMaster { public int TestCaseID { get; set; } public bool IsDeleted { get; set; } } Oct 9, 2022 · If this still doesn't work then the next thing to check would be how the "Context" reference is being initialized. Jun 1, 2018 · Regarding the SQL Server, I would suggest filtering SqlException. sql. As a suggestion, don't use email as a primary key. There are many other columns in the table I'm setting the value on, but don't have this problem. 2) Maybe you need to update your primary key to be a compound key (Key uses 2 or more columns) so the data used by the PK can be unique. id + 3 as NewKey,ti. Each has been setup as a unidirectional 1:M (one side is using a 1:1 for some reason), and both are using the same join table, causing duplicates when JPA goes to insert entries for both sides. SqlClient; using Microsoft. agent table will be populated with a different SID for user R (the disabled account that you created in the resource forest). May 30, 2016 · 7. Feb 25, 2013 · 1. *ls'. The primary key for the Poles table is the ObjectID. 이유는 user 테이블에 email 필드가 UNIQUEINDEX 로 걸려있기 때문이다. The duplicate key value is (State). 我们可以先删除已有的外键约束,然后再添加新的约束。 Jan 6, 2022 · The 'OrderID' in Order. where ti. "} System. CONSTRAINT [PK_Product] PRIMARY KEY CLUSTERED ( Aug 4, 2017 · Violation of PRIMARY KEY constraint 'PK_IDMaster'. The duplicate key value is (Teacher). INSERT IGNORE ¶. e. May 31, 2019 · So the application is multi-tenant, each identity user has a one on one relation with a tenant. mytable'" I have tried the following (to verify this isn't a duplicate question): Check that there is no actual duplicate in the destination: The destination is empty Jun 11, 2014 · This is because you already have "email" in your table which you have set as primary key. The duplicate key value is (31335A11) part_num 31335A11 appears in the csv file more than once. SaveChanges, I get a DbUpdateException: An unhandled exception of type 'System. " – Даниил Лукьянов. One possible issue would be if "Context" was somehow resolving to a new DbContext instance with each access such as: private YourAppDbContext Context. Customer'. Apr SQLEXCEPTION – This is a shorthand for the class of SQLSTATE values that do not begin with '00', '01', or '02'. But, it may be OK to store duplicate IDs, it depends on how they are used later. Sep 15, 2016 · If you look at the result of your query, the foreign key bid_ibfk_3 already exists. Oct 30, 2014 · When you combine your update statement data into the constrained key, were you to do a select by that key you would find that you return a single result. Oct 31, 2009 · You should use the following (if you are updating the database): member. Since this is a Primary key violation you are trying to insert something which will make the data used by the primary key not unique. Persons' with unique index 'IX_Persons_TitleId'. You could run a query to confirm that you have a duplicate: TopicShortName, COUNT(*) DimMeasureTopic. useDelimiter("[^0-9]+"); But why do you use the same value for your second sql parameter? Sep 15, 2022 · I'm sure the field is unique and how I understand if a row with this HitId is already in database this row must ignored. I also tried to attach the user object before doing the add and I got the same result. Data. RT. Entry(new Models. __M_M Mar 21, 2018 · and it is violation of primary key. Additional Jun 30, 2010 · 3. The duplicate key value is (15ae8798-8567-457b-812a-5820cf7843e5). Exceptions. [Product] ON , i tried this but no use . The duplicate key value is (ABC). I have this entities Turn the Pluralization On. SqlClient. entity-framework. To resolve this issue, find the duplicate records and purge them from the source table. All columns that make a PRIMARY KEY must be unique. Here is a picture of the error: Not quite sure what else to try and catch the specific exception. SqlException: Violation of PRIMARY KEY constraint 'PK_IdentityUser'. You have to traverse the inner exceptions until you find the SqlException, for which you can use this method: public TException GetInnerException<TException>(Exception exception) Mar 8, 2019 · Inner Exception 1: SqlException: Violation of PRIMARY KEY constraint 'PK_Challenge'. Aug 14, 2013 · You have a total of 14 ? marks i. Below we have explained this concept INSERT 시에 중복 (Duplicate) 키 에러가 난다면… ¶. . From my understanding, AddOrUpdate should not add if the entity already exists. What am I doing wrong? What is a good approach to create many to many relations? Just update the ColumnD column (or all non-key columns) and insert new ones from the Table2. using Microsoft. FirstOrDefault(); Make sure you are using Find () method from EntityFramework library with will get user by Id key (it will fetch data from context first instead of making trip to database) instead of query database with Where () linq method. Reflection. I would order statements so that firstly goes UPDATE and then INSERT , so that the UPDATE works on smaller set of original rows (before the insert). Jan 28, 2021 · InnerException = {"Cannot insert duplicate key row in object 'dbo. SDE_versions'. Aug 17, 2018 · Violation of UNIQUE KEY constraint. MembershipTypes' and the index name 'PK_dbo. The duplicate key value is (1). oa_AcademicHead' with unique index 'IX_oa_AcademicHead_personid'. The duplicates are caused by your company-employee relationship being duplicated in both entities. try-catch. Name. A duplicate key exception means that the data for a key in the database already exists. \r\nThe statement has been terminated. Cannot insert duplicate key in object '%. Sep 26, 2012 · Turns out that SQL Server, by default, sets indexed fields to allow only unique values. Feb 10, 2019 · The duplicate key value is (0). startsWith("23"); Because somehow catch (Exception e) does't catch "SqlException: Cannot insert duplicate key row". def projekt_classics bid_ibfk_2 projekt_classics bid FOREIGN KEY --the row below is the foreign key that you are trying to create def projekt_classics bid_ibfk_3 projekt_classics bid FOREIGN KEY def projekt_classics car_ibfk_1 projekt_classics car FOREIGN KEY def Sep 16, 2019 · var userID = context. Jul 21, 2019 · What you get is a DbUpdateException, its inner exception is an UpdateException and this exception's inner exception is a SqlException. Oct 30, 2015 · Such duplicates prevent the creation of a UNIQUE index. You need to have the same number of setter method as the number of ? Apr 9, 2024 · In this article, we will learn how to handle duplicate key violations in JDBC by using try and catch block. DETAIL: Key (email)=( johndoe@example. ---> Telerik. Apr 20, 2022 · i have a table where it uses the identify column inside the table, trying to insert the records into the table getting the below error, and have the composite primary key in my table that is ,the below is the table definition, Set identity_Insert [dbo]. SQLException: Cannot insert duplicate key row in object '<tableName>' with unique index '<index>'. So to determine whether the SQL Exception is caused by a constraint violation, you can just do the following in a (fictive) SQLUtil class: public static boolean isConstraintViolation(SQLException e) {. If we insert new data with an already existing primary key, we get an SQL exception then we need to handle that exception properly. SomeVal. HorarioFixo_JanelaHorarioFixo_Auditoria'. DuplicateKeyException: Cannot add an entity with a key that is already in use. The duplicate key value is (23, 1). Add(item); try. The code listed below attempts to update a row in the database, but throws an exception instead: System. Otherwise, the new data is successfully inserted into the database. Groups(roles)); Apr 30, 2018 · 1) We created a Java application that collected user name, age, height, weight, hip, waist. 3F: invalid schema name. However while creating the PreparedStatement object you are setting only 7. SQLSTATE is a five-character that provides information about the result of an SQL operation. java. SQLSTATE [VALUE] sqlstate_value – This is a string that indicates an SQLSTATE value, such as '42S01' means “Unknown table”. com) already exists. 1. An index does exist on that table that is unique and non-clustered for A, B, C, but why is it considered duplicate data when the table itself is empty? Aug 11, 2022 · Background and motivation When a duplicate key value interrupts a SQL command, you get a SqlException with a message like this: ---> Microsoft. Group(role)); And if the above code doesn't work, try this (if you are adding to the database): // First, search for the particular obj you want to insert. Stocks' with unique index 'IX_Stocks_Name'. 만약 중복이 발생한다면 지금 삽입하려는 ROW를 무시한다. messages where text like '%Cannot insert duplicate key%' (% at start of string) – Aug 18, 2011 · Excellent deduction of my problem. It would be easy if it was just this entry, but I have more than 1,000 repeat entries, so it would take Sep 15, 2020 · SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "users_pkey" DETAIL: Key (id)=(1) already exists. c#. SqlException: "Violation of PRIMARY KEY constraint 'PK__tmp_ms_x__1A00DC411E67C062'. As such it appears in the part_temp table more than once. – ttt. This is a continuation of the earlier tip, which describes steps to fix transactional replication when it fails due to primary key violations. Below is a screenshot of the AspNetRoles table: Sep 6, 2015 · I think you read the wrong int's so you end up with the wrong values and generate duplicate keys, which violates the constraints. System. – Damien_The_Unbeliever Mar 20, 2019 · 2. get { return new YourAppDbContext(); } Aug 12, 2018 · SqlException: Violation of PRIMARY KEY constraint 'PK_StudentCourses'. I am assuming even if my sproc is called at the same time with the same values, the checks should be able to prevent the duplicate key insertion attempts. Cannot insert duplicate key into object 'dbo. set personid=15857. SET A = @val1. parts'. Your primary key comes from parts[i][0] (with i starts at 0) at line: Scanner in = new Scanner(parts[i][0]). Users' with unique index 'UX_Users'. Click on the primary key column. But in reality you need to pick a value that will keep your new keys separate from any possible old key, maybe: Nov 8, 2020 · Let’s say that this is the exception you are getting when trying to insert a duplicate user email: Msg 2627, Level 14, State 1, Line 2 Violation of UNIQUE KEY constraint 'IX_User_Email'. If you really need to filter out duplicates, then good solution should be IGNORE_DUP_KEY as Aaron said - I tried to find this hint in docs earlier, but couldn't because it is not in the section with table/query hints, but it's an index option. The duplicate key value is (39b72c3a-b5bf-43e4-84f9-5cddbe79f6e3). Apr 2, 2024 · このコードを実行すると、以下のエラーメッセージが表示されます。. getSQLState(). Cannot insert duplicate key row in object dbo. Dirty reads resulting from read uncommitted isolation causing a large parallel update to double insert. login1' 1. BookTag'. Write the insert not to insert duplicate keys, and check with @@rowcount if a row was added: Apr 18, 2024 · But what if we want to catch a SqlException specifically, and only when a Duplicate Key error has occurred? To achieve this we can use an Exception Filter, as shown below. messages table the message is 'Violation of %ls constraint '%. SaveChanges() and Attach() and other orders, but I fail always with above exception. AoObject' with unique index 'AoObject_AK_ClassName'. as long as it catches a constraint which indicates a duplicate record (which could be either) that's good enough for me. oa_AcademicHead. The duplicate key value is (Poles, DBO). InnerException {"Violation of PRIMARY KEY constraint 'PK_dbo. See previous errors. exception. ,},],' There are no duplicate Primary Key values to begin with, why do I keep getting these strange errors? Thanks in advance Jan 5, 2019 · Violation of PRIMARY KEY constraint 'PK'. Manufacturers'. This is the SQL duplicated: Message: System. OpenAccess. where personid=1234. This is due to locking; initially in the read committed isolation level will take a shared lock on the (in this case) key while reading what the maximum value is. If you need to do the same in Entity Framework Core you can use the library that I built which provides strongly typed exceptions including UniqueConstraintException: EntityFramework. Presumably in the other database the data are different, and the duplicates are not present. UPDATE. This issue occurs because there's an existing entry in the agent table that's used by the response groups. e. Violation of PRIMARY KEY constraint 'PK__HorarioF__450088476960C81E'. このエラーは、 users テーブルの email カラムに、 johndoe@example. The solution is to select by the key first and see if it exists and either update that if desired, xor delete the duplicate, or do something else. Just that I was already doing the Example 3. The only difference is that instead of getting user via GetUserFromSomeWhere(); I was passing the user object as a parameter over the WCF wire Apr 16, 2018 · SqlException: Cannot insert duplicate key row in object 'dbo. you can not have two or more data with same ID. dll. Jan 1, 2010 · 3D: invalid catalog name. SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo. Mar 19, 2014 · When calling DbContext. Jul 22, 2018 · The issue was the following: When adding the users, I had set the User IDs explicitly; We were using soft deletes, so deleting the existing user wasn't actually deleting it Dec 31, 2021 · Violation of PRIMARY KEY constraint 'PK_login1'. 이럴 때는 3가지 옵션이 있다. You can see this additional message by changing the mentioned query to select * from sys. I'm trying to add data to the database using EF Core, but I cannot overcome duplicate key error: Cannot insert duplicate key row in object 'dbo. Commented Feb 5, 2018 at 14:38. 6, “Scope Rules for Handlers” . Jul 20, 2015 · In my case, I'm using EF 6 and decorated one of the properties in my model with: [Index(IsUnique = true)] To catch the violation I do the following, using C# 7, this becomes much easier: protected async Task<IActionResult> PostItem(Item item) {. Feb 18, 2012 · java. EntityFrameworkCore; try { // Code omitted for brevity. The duplicate key value is %ls. But not worked. Is that correct? How would I adjust the code to fix this issue? Jun 1, 2020 · Cannot insert duplicate key row in object 'dbo. Apr 29, 2014 · Error: System. A negative domain would ensure that values provided by a human never interfere with the domain you have allocated for Teradata to use in generating the IDENTITY value. 1 1. } catch (DbUpdateException ex) when (ex. Observation & Analysis Enumerate the observations of interest in logs/tool output that are of interest. The duplicate key value is (XYZ Company). net. From reading similar questions, it seems that I should declare the ID in the statement. The dbo. Using SaasKit i was caching the database model Tenant into memory, while creating a new user like so: IdentityUser. fw de mn gr uk dp lx gd qc wk