title: SQL Insert - Msg 207 Invalid column name
body: <p>The issue is that I am trying to insert some data into my SQL server database, but for some reason I keep getting the infamous "invalid column name" error, and nothing is inserted as a result.</p>
  
  <p>Now, I believe I know WHY (sort of) this is happening, as I am trying to insert a value that is based on the value of a field in another column using a case query, but I'm not sure I'm really doing this right - see the codes:</p>
  
  <pre><code>INSERT INTO dbo.table_name(points, discount)
  VALUES
  (3, CASE WHEN (points = 6) THEN 0.5 WHEN (points = 12) THEN 1.0 ELSE 0 END
  </code></pre>
  
  <p>I am getting the invalid column name on the "points" column. It is definitely there so am I correct in thinking that my query is not right, or that I should be going about this a different way? </p>
  
  <p>I am using SQL server 2008 R2 - not sure if that makes any difference.</p>