title: Insert Multiple Rows into Table from a Table
body: <p>I have a SQL Server 2008 database. The database has a stored procedure which receives two strings as parameters. One parameter is used to build a temp table which will usually only have 1 or 2 rows but theoretically could have more. </p>
  
  <p>For each row in the temp table, I need to insert a row into a different table that consists of the other parameter and the contents of the temp table. Is there a way to do this without a cursor?</p>
  
  <p>I've tried variations on the following: </p>
  
  <p>Pseudo code:</p>
  
  <pre><code>procedure InsertLinks(@Key varchar(36), @LinkKey varchar(36)
  
  tempLinks Table = getLinks(@LinkKey)
  
  Insert into MyTable (Key, LinksTo) Values (@Key, Select LinksTo From tempLinks)
  </code></pre>