Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:54:07+00:00 2026-06-13T11:54:07+00:00

I have two tables in my database. TableOne has theKey primary key. TableTwo has

  • 0

I have two tables in my database. TableOne has theKey primary key. TableTwo has a foreign key theKey that refers to the corresponding column in the TableOne. Now I am trying to update theKey in TableTwo:

  UPDATE TableTwo
  SET theKey = NewIk
  FROM TableTwo W
  JOIN TableThree D ON W.theKey_backup = D.OldIk
  WHERE dt >= '2012-05-01'

But I receive the following error:

The UPDATE statement conflicted with the FOREIGN KEY constraint
“FK_TableTwo_TableOne”. The conflict occurred in database “MyDB”,
table “dbo.TableOne”, column ‘theKey’.

Could you please explain why I get this error if I don’t touch the TableOne?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:54:07+00:00Added an answer on June 13, 2026 at 11:54 am

    You’re trying to set TableTwo.theKey to a value that doesn’t exist in the referenced table, TableOne – that’s what the error is saying.

    So you need to check why this is happening – where are you selecting that new value from? Why is it a value that doesn’t (yet) exist in TableOne?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two database tables: 'MyTable' which has a standard auto-incrementing primary key integer
I have two database tables with the following structure: actions: action_id int(11) primary key
I have two tables in my database USERS, and USER_SESSIONS. USER_SESSIONS has a foreign
I have two tables in my database schema that represent an entity having a
I have two tables in my database that look like that: Customer: C_ID city
I have two database tables that have a many to many relationship: People and
I have two database tables, 'Lists' and 'Notes'. Lists has columns _id, listname Notes
I have two database tables that represent lists of items that belong to parent
I have two tables TableOne (TABLE_ONE_ID (pk), TABLE_TWO_ID (fk), ...(something else) ) TableTwo (TABLE_TWO_ID
I have two database tables. One table stores data for a commitment that a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.