title: SQL Database storing different types of values (in or simulated as a single field)
body: <p>In a database I want to be able to assign values of a varying type to variables in a variable table. So do I need a separate value table for each value type? If so, I am not sure how you would actually link Values to the right table and thus right value. How can I achieve what I am after?</p>
  
  <pre><code>Variables
      ID
      Name
  
  VariableValuesLink
      ID
      IDVars
      IDVals
  
  Values
      IDvals
  
  ValuesValueLink
      ID
      IDvals
      IDval
  
  ValuesInt
      IDval
      IntVal
  
  ValuesFloat
      IDval
      FloatVal
  
  ValuesDouble
      IDval
      DoubleVal
  
  etc...
  etc...
  etc...
  etc...
  </code></pre>
  
  <p>The aim is for me to get something like this:</p>
  
  <pre><code>Variable: 
      ezas123
  Values:
      1 (Int)
      2.0 (Float)
      3.0 (Double)
  
  Variable:
      QuickFox
  Values:
      The (TinyText)
      Quick (TinyText)
      Brown (TinyText)
      Fox (TinyText)
      Jumped (TinyText)
      Over (TinyText)
      The (TinyText)
      Lazy (TinyText)
      Dog (TinyText)
  
  Variable:
      Pangrams
  Values:
      The Quick Brown Fox Jumped Over The Lazy Dog (Text)
      How quickly daft jumping zebras vex (Text)
  </code></pre>
  
  <p>So when I query the DB I would be able to get back this set of results (where the values are of a varying type)</p>
  
  <pre><code>Variable    Value
  ezas123     1
  ezas123     2.0
  ezas123     3.0
  QuickFox    The
  QuickFox    Quick
  QuickFox    Brown
  QuickFox    Fox
  QuickFox    Jumped
  QuickFox    Over
  QuickFox    The
  QuickFox    Lazy
  QuickFox    Dog
  Pangrams    The Quick Brown Fox Jumped Over The Lazy Dog
  Pangrams    How quickly daft jumping zebras vex
  </code></pre>