Save output of multiple queries into file?
<p>I have a SQL query that I have to run against multiple (15) tables in <strong>SQL Server Management Studio</strong>.</p>

<p>Is it possible to save the result of multiple queries into a file? (.txt, excel sheet?)</p>

<p>Using <code>union</code> is not possible because not all tables have an equal amount of columns. </p>

<p>The queries look somewhat like this</p>

<pre><code>select *
from tableA
where main_id in (select id from maintable where date is null and status ='new')

select *
from tableB
where main_id in (select id from maintable where date is null and status ='new')

select *
from tableC
where main_id in (select id from maintable where date is null and status ='new')

select *
from tableD
where main_id in (select id from maintable where date is null and status ='new')

select *
from tableE
where main_id in (select id from maintable where date is null and status ='new')
</code></pre>