title: Perform insert for each row taken from a select?
body: <p>I have a number of records that I need to insert into multiple tables. Every other column will be a constant.</p>
  
  <p>Poor pseudo code below - this is what I want to do:</p>
  
  <pre><code>create table #temp_buildings
  (
      building_id varchar(20)
  )
  insert into #temp_buildings (building_id) VALUES ('11070')
  insert into #temp_buildings (building_id) VALUES ('11071')
  insert into #temp_buildings (building_id) VALUES ('20570')
  insert into #temp_buildings (building_id) VALUES ('21570')
  insert into #temp_buildings (building_id) VALUES ('22570')
  
  insert into property.portfolio_property_xref
          ( portfolio_id ,
            building_id ,
            created_date ,
            last_modified_date
          )
  values
          ( 
              34 ,
              (
                  select  building_id
                  from    #temp_buildings
              ) ,
              getdate() ,
              null
          )
  </code></pre>
  
  <p><strong>Intent:</strong> Perform an insert into property.portfolio_property_xref for each record on #temp_buildings</p>
  
  <p>I think I could do this with a cursor - but believe this would be horribly slow. As this exercise will be repeatable in future I'd rather tackle this in a faster method but I'm unsure how. Any feedback would be appreciated!</p>