Using SQLCMD
, I can output the query result to a text file, now, the text file has header:
And footer:
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
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