Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe I have found the cause and IMO this is a very poor design decision by the Microsoft folks.</p> <p>I went to create a new Foreign Key and set the Primary Key Table and Foreign Key Table and their columns. I then realized that I needed to clean the data in the table before creating the Foreign Key, so I clicked close. What I discovered is that this creates a pending Foreign Key as I described in my question, a FK comprised of the Primary Key fields referencing itself. </p> <p>So what I can reasonably guess has happened is that at some point on these 5 tables, I started to create a FK, thought I had aborted that operation when I hit close, and then made another change to the table, such as adding a field or changing a datatype, and then when I saved the table, I got an unintended FK created. I might add that it was an FK with parameters I had never set.</p> <p>This is a bug in my opinion.</p> <p>Edit: I just discovered that it's actually worse than I described. Even if you hit the cancel button on the Foreign Key creation dialog, it still creates the self-referencing Foreign Key in a pending state. This is terribly stupid.</p> <p>Edit 2: This keeps getting worse the more I investigate. I just got it to save one of these self-referencing FK's by closing SSMS and clicking No on the save changes dialog. I reopened SSMS and the self-referencing FK had been created anyway. Just to recap, I clicked Cancel on the create FK dialog, and No on the save changes dialog, and it created a Foreign Key with parameters I had never set.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload