title: Insert values from Database 1 into Database 2
body: <p>Here is the powershell script to query Database 1 and store records in $sql_output</p>
  
  <pre><code>$SQL1 = "SELECT Computer_Name, IP_Address, OS, BIOS
  FROM ...
  WHERE ..."
  
  $conn.Open()
  
  $cmd = New-Object System.Data.SqlClient.SqlCommand($SQL1,$conn)
  
  do{
      try{
          $rdr = $cmd.ExecuteReader()
  
          while ($rdr.read()){
              $sql_output += ,@($rdr.GetValue(0), $rdr.GetValue(1), $rdr.GetValue(2), $rdr.GetValue(3))
  
          }
          $transactionComplete = $true 
  
      }
      catch{
          $transactionComplete = $false
      }
  }until ($transactionComplete)
  
  $conn.Close()
  </code></pre>
  
  <p>I need to store all the records of $sql_output, and there are <strong>thousands</strong> of these records</p>
  
  <p>How do I create an INSERT statement that will insert $sql_output into Database 2 (which is on a different server than Database 1)</p>
  
  <p>I'm using SQL Server 2008</p>