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

  • SEARCH
  • Home
  • 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 6616397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:34:39+00:00 2026-05-25T20:34:39+00:00

Do Foreign Key constraints get checked on an SQL update statement that doesn’t update

  • 0

Do Foreign Key constraints get checked on an SQL update statement that doesn’t update the columns with the Constraint? (In MS SQL Server)

Say I have a couple of tables with the following columns:

OrderItems

    - OrderItemID
    - OrderItemTypeID (FK to a OrderItemTypeID column on another table called OrderItemTypes) 
    - ItemName

If I just update

update [dbo].[OrderItems]
set    [ItemName] = 'Product 3'
where  [OrderItemID] = 2508 

Will the FK constraint do it’s lookup/check with the update statement above? (even thought the update is not change the value of that column?)

  • 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-05-25T20:34:40+00:00Added an answer on May 25, 2026 at 8:34 pm

    No, the foreign key is not checked. This is pretty easy to see by examining the execution plans of two different updates.

    create table a (
        id int primary key
    )
    
    create table b (
        id int, 
        fkid int
    )
    
    alter table b add foreign key (fkid) references a(id)
    
    insert into a values (1)
    insert into a values (2)
    
    insert into b values (5,1) -- Seek on table a's PK
    

    enter image description here

    update b set id = 6 where id = 5 -- No seek on table a's PK
    

    enter image description here

    update b set fkid = 2 where id = 6 -- Seek on table a's PK
    

    enter image description here

    drop table b
    drop table a
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are disabling and enabling foreign key constraints supported in SQL Server? Or is my
SQL Server 2005. I'm adding Foreign Key constraints to the database of an application
In MySQL, how do I get a list of all foreign key constraints pointing
What is the purpose of naming your constraints (unique, primary key, foreign key)? Say
I just learned, to my amazement, that foreign key constraints can be non-trusted. This
I have a broken foreign key in SQL Server 2005. Here is a reproduction:
I want to disable all Foreign key constraints and re-enable them after, is there
can i perform cascaded delete using foreign key constraints in MySql 3.0 ?
The new version of SQLite has the ability to enforce Foreign Key constraints, but
We're designing a database in which I need to consider some FK(foreign key) constraints.

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.