Write output to a file

In Interactive SQL, the output for each command remains in the Results pane until the next command is executed. To keep a record of your data, you can save the output of each statement to a separate file.

If statement1 and statement2 are two select statements, then you can output them to file1 and file2, respectively, as follows:

Statement1; OUTPUT TO file1
go
statement2; OUTPUT TO file2
go

For example, the following command saves the result of a query:

select * from titles
go
output to "C:\My Documents\Employees.txt"