Alternatively, you might be able to reshape your solution to put the SQL directly into a SQL variable so you won't have to write the script to process the report. Very likely, your solution will be faster when using a SQL variable, since you won't have the extra step of processing the report. If that is not possible, then Michael's answer is your only choice.