title: How do I fix "The name 'X' is not permitted in this context"?
body: <pre><code>INSERT INTO dbo.VehiclesCategories ( VehicleId, CategoryId )
  VALUES ( t1.ID , t2.ID)
  
  SELECT t1.ID, t2.ID
  FROM dbo.Vehicle t1
  inner JOIN dbo.VehicleCategory t2 ON t1.Category = t2.Name 
  </code></pre>
  
  <p>In the above SQL, I want to insert two values into a M:M join table. The SELECT statement works fine and I get the desired results. The INSERT statement throws the following error:</p>
  
  <pre><code>Msg 128, Level 15, State 1, Line 2
  The name "t1.ID" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
  </code></pre>
  
  <p>How do I insert the two values (t1.ID and t2.ID) into the table?   </p>