9

Using SQLCMD, I can output the query result to a text file, now, the text file has header: enter image description here

And footer: enter image description here

How do I remove them during query?

My query, inside a sql file:

SELECT internal_no, item_no, dspl_descr, rtl_prc FROM PLU

My SQLCMD command:

SQLCMD -S SQLSERVER01 -U AdminUser -P au5584 -i C:\text.sql -o C:\out.txt

jaa2013
  • 221
  • 2
  • 3
  • 11

1 Answers1

20

Add

SET NOCOUNT ON

To the top of your query

SET NOCOUNT ON    
SELECT internal_no, item_no, dspl_descr, rtl_prc FROM PLU

And add "-h-1" your SQLCMD command to:

SQLCMD -h-1 -S SQLSERVER01 -U AdminUser -P au5584 -i C:\text.sql -o C:\out.txt
Dbloch
  • 2,326
  • 1
  • 13
  • 15