title: There are no primary or candidate keys in the referenced table
body: <p>I have two tables:</p>
  
  <p>Table1</p>
  
  <hr>
  
  <blockquote>
    <p>c_ID float - PK<br>
    Field1<br>
    Field2<br>
    Field3<br>
    p_ID [uniqueidentifier]</p>
  </blockquote>
  
  <p>and </p>
  
  <p>Table2</p>
  
  <hr>
  
  <blockquote>
    <p>p_ID nvarchar<br>
    s_ID float</p>
  </blockquote>
  
  <p>where both p_ID and s_ID are part of the primary key.</p>
  
  <p>I tried to create a foreign key on Table1:</p>
  
  <pre><code>ALTER TABLE Table1
  ADD CONSTRAINT FK_Table1_Table2 FOREIGN KEY (p_ID) 
      REFERENCES Table2(p_ID) 
  </code></pre>
  
  <p>and I got an error:</p>
  
  <blockquote>
    <p>There are no primary or candidate keys in the referenced table
    'dbo.Table2' that match the referencing column list in the foreign key
    'FK_Table1_Table2'.</p>
  </blockquote>
  
  <p>Am I getting this error because data type of <code>p_ID</code> is uniqueidentifier and in Table2 <code>p_ID</code> is nvarchar? Is there a workaround?</p>