title: SQL Server Foreign Key references invalid Table 'employees'
body: <p>I try to run this SQL Server query:</p>
  
  <pre><code>USE DB_UBB;
  
  CREATE TABLE dept_emp (
      emp_no      INT         NOT NULL,
      dept_no     CHAR(4)     NOT NULL,
      from_date   DATE        NOT NULL,
      to_date     DATE        NOT NULL,
      FOREIGN KEY (emp_no) REFERENCES employees(emp_no) ON DELETE CASCADE, -- Error here
      FOREIGN KEY (dept_no) REFERENCES departments(dept_no) ON DELETE CASCADE, -- And here
      PRIMARY KEY (emp_no, dept_no)
  );
  CREATE INDEX (emp_no);
  CREATE INDEX (dept_no);
  </code></pre>
  
  <p>and I get these errors:</p>
  
  <pre><code>Foreign key 'FK__dept_emp__8bc6840bee39d6cef4bd' references invalid table 'employees'.
  
  Foreign key 'fk__dept_emp__99bc0b2304d3f32059a9' references invalid table 'departments'.
  </code></pre>
  
  <p>even though I have these tables:</p>
  
  <p><a href="https://i.stack.imgur.com/WNKQm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WNKQm.jpg" alt="Departments"></a></p>
  
  <p><a href="https://i.stack.imgur.com/MrLyw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MrLyw.jpg" alt="Employees"></a></p>
  
  <p>What do I do wrong?</p>
  
  <hr>
  
  <p><em>EDIT:</em></p>
  
  <p>Added Whole DB:</p>
  
  <p><a href="https://i.stack.imgur.com/b6FLG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b6FLG.jpg" alt="enter image description here"></a></p>