title: INSERT multiple rows with SELECT and an array
body: <p>In EXCEL/VBA I can program my way out of a thunderstorm, but in SQL I am still a novice.  So apologies, after much Googling I can only get partway to a solution which I presume ultimately will be pretty simple, just not wrapping my head around it.</p>
  
  <p>I need to create an INSERT script to add multiple rows in a 3-column table.  A simple insert would be:</p>
  
  <pre><code>INSERT INTO table VALUES(StoreId, ItemID, 27)
  </code></pre>
  
  <p>First hurdle is dynamically repeat this for every StoreID in a different table.  Which I think becomes this:</p>
  
  <pre><code>INSERT INTO table 
  SELECT (SELECT StoreID FROM Directory.Divisions), ItemID, 27)
  </code></pre>
  
  <p>If that is actually correct and would effectively create the 50-60 rows for each store, then I'm almost there.  The problem is the ItemID.  This will actually be an array of ItemIDs I want to feed in manually.  So if there are 50 stores and 3 ItemIDs, it would enter 150 rows.  Something like:</p>
  
  <pre><code>ItemID = (123,456,789,246,135)
  </code></pre>
  
  <p>So how can I merge these two ideas? Pull the StoreIDs from another table, feed in the array of items for the second parameter, then my hardcoded 27 at the end.  50 stores and 10 items should create 500 rows.  Thanks in advance.</p>