SQLcmd output contains also unwanted input SQL statements

863 views Asked by At

I created a sql script that retrieve some information from database as a table format,

I have create a sqlcmd script that execute that query file, but in the output file I have the queries present in the .sql file + the results that are saved, result file http://prntscr.com/7e4j5i

I want only to have the result in that file

SQLCMD -S pcname\SQLEXPRESS -v VITI=%vl% -E -w 166 -e -i C:\db\input.sql -o C:\db\Book1.csv -s","  -w 700 -es

How can I do it?

Do I have to change something in the .sql file to exclude the queries from the results file?

1

There are 1 answers

0
Donal On BEST ANSWER

Remove the -e parameter.

The -e parameter will echo the input (i.e. your SQL).

For info, see here.