我有一个 SQL CmdExec 作业设置来运行查询,但是输出数据包含标题、作业信息和返回行的总数作为输出文件的一部分,我试图弄清楚如何排除它,这个项目只需要要返回的原始数据。
根据其他建议,我尝试在查询之前添加“sqlcmd -Q set nocount on;”,并在查询末尾添加“-S localhost -D master -o” ,但额外的数据仍保留在结果中。
非常感谢任何建议。
sqlcmd -Q set nocount on;
SELECT
cast(coalesce(ARMASTER.CUSTNO, ' ') as char(20)) as [CUSTNO],
cast(coalesce(ARMASTER.INVOICE, ' ') as char(20)) as [INVNO],
cast(coalesce(ITEM.PARTNO, ' ') as char(16)) as [ITEM],
cast(coalesce(ITEM.DESCRIPT, ' ') as char(65)) as [DESCRIP],
cast(coalesce(ITEM.DISRATE, ' ') as char(7)) as [DISC],
cast(coalesce(ITEM.PRICE, ' ') as char(20)) as [PRICE],
cast(coalesce(ITEM.SHIPQTY, ' ') as char(12)) as [QTYSHP],
cast(coalesce(ITEM.TOTPRICE, ' ') as char(20)) as [EXTPRICE],
cast(coalesce(ITEM.CUSERLINE, ' ') as char(10)) as [SEQNUM]
FROM ITEM
JOIN
armaster ON ITEM.invoice = ARMASTER.invoice
ORDER BY ARMASTER.INVOICE
-S localhost -D master -o