title: SQL Server INSERT new records
body: <p>Before I posted this I read <a href="https://stackoverflow.com/questions/15182468/sql-server-2008-insert-with-while-loop">this</a> too. But I thought may be my issue was slightly different.</p>
  
  <p>I have a scenario  where my table struct is as follows:</p>
  
  <p><strong>my_table</strong>:</p>
  
  <pre><code>my_id | what_I_have | what_I_can_do
  </code></pre>
  
  <p>I don't have a primary key because the table is a lookup table (nothing fundamental). All I want is to get a set of values for <code>my_id</code>, which is based on certain values for <code>what_I_have</code>, and <code>what_I_can_do</code>. Once I get a resultset (with <code>my_d</code>), I want to insert new records into <code>my_table</code> for each of the <code>my_id</code> in the result set with additional information for other columns. </p>
  
  <p>E.g.</p>
  
  <pre><code>01001 | boxes | delivery  | (existing)
  01002 | boxes | delivery  | (existing)
  01001 | boxes | unpacking | (new)
  01002 | boxes | unpacking | (new)
  </code></pre>
  
  <p>I have thought about doing the following:</p>
  
  <pre><code>INSERT INTO my_table(my_id, what_I_have, what_I_can_do, my_customer_company)
      SELECT 
          my_id, 'boxes', 'unpacking' 
      FROM 
          my_table (NOLOCK)
      WHERE 
          my_id IN (SELECT b.my_id FROM my_table b(NOLOCK) 
                    WHERE b.what_I_have = 'boxes' 
                      AND b.what_I_can_do = 'delivery')
  </code></pre>
  
  <p>I know that there might be a way to use <code>INNER JOIN</code> and get this done smoothly without "nesting". But is this going to work or am I missing something here?</p>
  
  <p>KR,</p>