title: Complex foreign key
body: <p>I have a table similar to this:</p>
  
  <pre><code>    CREATE TABLE [dbo].[Table1](
  [Option_PK] [bigint] IDENTITY(1,1) NOT NULL,
  [Option_1] [varchar](10) NULL,
  [Option_2] [varchar](10) NULL,
  [Option_3] [varchar](10) NULL)
  </code></pre>
  
  <p>What I am attempting to do, is add a table driven constraint which can effectively restrict valid entries on a per-column basis. For example, if I made a second table:</p>
  
  <pre><code>    CREATE TABLE [dbo].[Table2](
      [FK_Name] [varchar](10) NOT NULL,
      [FK_Value] [varchar](10) NOT NULL)
  </code></pre>
  
  <p>I would then want to check that the value stored in Table1, column "Option_1", existed in Table2, column "FK_Value", where the value of "FK_Name" was "Option_1".</p>
  
  <p>Is this possible with either a check or an FK?</p>
  
  <p>** Edit to make the column datatypes match; I hand typed the example table declarations and typo'd, this wasn't relevant to the problem. I know how to do a FK, I don't know how to do an FK like what I'm describing.</p>