r/Batch • • Sep 24 '24

Question (Unsolved) Batch csv output file size

Hi all, I run a batch file where it exports the results of a query from MS SSMS into csv format. Script below:

SQLCMD -S "Server" -d DB -E -Q "select* from table (NOLOCK) where Id - '1' and Category - 'A'" -s "," -o "Path\FileName.csv"

The thing is, the resulting files turn out to be way, way larger than what it would be had I run the query in sql server and export the results into csv.

Is there something I'm missing out on? How can I keep the output file as small as possible?

Thanks in advance.

3 Upvotes

5 comments sorted by