title: Create primary key / foreign key relationship between two tables
body: <p>I am setting up some very simple test tables and would like to make the column <code>USERKEY</code> the primary key of my table <code>tb_TestUSERS</code> then make the column <code>USERKEY</code> the foreign key in the table <code>tb_TestFACT</code>. Then set up a relationship between this primary key and foreign key. I'd like to be able to do all of this using scripts.  </p>
  
  <p>So far I just have the basic table scripts:</p>
  
  <pre><code>CREATE TABLE WH.dbo.tb_TestFACT
  (DATEKEY INT,USERKEY INT);
  INSERT INTO WH.dbo.tb_TestFACT
      values
      (1,1),
      (2,1),
      (3,2),
      (4,2),
      (5,2),
      (6,3),
      (7,3);
  
  CREATE TABLE WH.dbo.tb_TestUSERS
  (USERKEY INT,NAME VARCHAR(10));
  INSERT INTO WH.dbo.tb_TestUSERS
      values
      (1,'FRED'),
      (2,'PHIL'),
      (3,'JACKO'); 
  </code></pre>