I have a bunch of very simple SELECT
statements. I would like to output them all to the same resultset (UI table or file). Here is the most recent thing I tried:
@export on;
@export set filename="c:\test.csv";
@export set CsvColumnDelimiter=",";
SELECT TOP 1 * FROM TableName WHERE ID = 1;
SELECT TOP 1 * FROM TableName WHERE ID = 2;
SELECT TOP 1 * FROM TableName WHERE ID = 3;
SELECT TOP 1 * FROM TableName WHERE ID = 4;
SELECT TOP 1 * FROM TableName WHERE ID = 5;
@export off;
Obviously the CSV file only contains ID 5 because it's just overwriting. Is there any way to append? Or, is there any SQL
option outside of DBVis that will allow me to execute all these SQL queries into one result set?
Scott, try:
@export on;
@export set filename="<outputfile.csv>" appendfile="true";
select * from tab;
@export set CsvIncludeColumnHeader="false";
select * from tab;
select * from tab;
This will export the first result set with column headers and the following result sets without column headers.