Sounds to me like your database needs redesigning. But if you REALLY want to do this, I suggest using a cursor and a temporary table. In script, first create a temporary table to hold the output, then open a cursor based on your original query. Looping through the output of your query, one record at a time, construct a piece of SQL to append records into the temporary table, using the select statement as the source of the records. When you've processed all your select statements, close and deallocate the cursor, and just do select * from temporary table. Lastly, drop the temporary table. I have done this before, but I think you really have to justify it to yourself, and that there isn't a completely different way of doing this which is more practical.