title: Creating a self referencing table
body: <p>I have a hierarchical table - it would suit a self referencing style, like this example I found.</p>
  
  <pre><code>CREATE TABLE OurStuff
  (
       StuffID INT NOT NULL PRIMARY KEY,
       StuffSubID INT NULL,
       StuffName VARCHAR(10) NOT NULL,
  
       CONSTRAINT fk_StuffID FOREIGN KEY (StuffSubID)
          REFERENCES OurStuff(StuffID)
  )
  </code></pre>
  
  <p>I have a similar table - however when I try to replicate using Visual Studio Server Explorer, I get an error message:</p>
  
  <blockquote>
    <p>"The columns in table 'abc' do not match an existing primary key or
    unique constraint"</p>
  </blockquote>
  
  <p>I can understand why, but I don't know why the above which is cited as an example would work and mine does not.</p>
  
  <p>UPDATE: Here the link to the page in the example <a href="https://www.simple-talk.com/sql/t-sql-programming/questions-about-primary-and-foreign-keys-you-were-too-shy-to-ask/#twelveth" rel="nofollow noreferrer">“How do I create a self-referencing foreign key?”</a></p>
  
  <p>UPDATE:</p>
  
  <p><img src="https://i.stack.imgur.com/H8cRa.gif" alt="enter image description here"></p>