我试图从表中获取两列打印到csv文件,我的代码目前看起来像:
var dates = [
"2017-09-11 13:30:45",
"2017-09-11 14:20:00",
"2017-09-11 15:00:00"
]
但输出包含我想删除的查询本身。我还需要有两个列名称的标题,所以我的输出看起来像:
set colsep
set headsep off
set pagesize 0
set trimspool on
set heading off
set arraysize 1
set newpage 0
set pages 0
set feedback off
set echo off
set verify off
spool C:\Users\me\Documents\file.csv
select COL_A||','||COL_B from MyTable;
spool off;
答案 0 :(得分:1)
set trimspool on
set heading on
set pages 10000
set lines 300
set feedback off
set echo off
set verify off
spool C:\Users\me\Documents\file.csv
@sqlfile.sql
spool off;
包含您的查询的sqlfile.sql