title: how do I automatically execute a query that returns insert statements?
body: <p>I wrote the following query in order to move some data to a joinTable:</p>
  
  <pre><code>SELECT 'insert into dbo.person_parks (person_id, parks_id) values
  ('+ cast([id] as nvarchar) +',' + [parks_id] + ');'
  FROM [dbo].[person] where parks_id is not null
  </code></pre>
  
  <p>Now this works fine as it displays the correct insert queries which I then take and execute on a separate query window, but how do I make it so they are executed/inserted automatically instead of being only displayed as a dataset?</p>
  
  <p>Sorry this may be super obvious and easy but I'm not that experienced in SQL-Server, I appreciate the help.</p>