HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

BCP export more rows per batch to file (queryout)

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
rowsqueryoutfilepermorebatchbcpexport

Problem

I am using Windows 10 and running this straight from the command prompt (Administrator). Is there a way to change the row count being output to a text file?

BCP "SELECT * FROM db.dbo.table WHERE row_date = '2016-10-11'" queryout "C:/Users/table.csv" -t, -c -S "servername" -T

1000 rows successfully bulk-copied to host-file. Total received: 1000
1000 rows successfully bulk-copied to host-file. Total received: 2000
1000 rows successfully bulk-copied to host-file. Total received: 3000
1000 rows successfully bulk-copied to host-file. Total received: 4000
1000 rows successfully bulk-copied to host-file. Total received: 5000
1000 rows successfully bulk-copied to host-file. Total received: 6000

12136 rows copied.
Network packet size (bytes): 4096


Then I tried -b 5000 and -b10000:

BCP "SELECT * FROM db.dbo.table WHERE row_date = '2016-10-11'" queryout "C:/Users/table.csv" -t, -c -b 5000 -S "servername" -T


But it still outputs 1000 rows. I tried to increase the packet size with -a but that didn't impact it at all.

Solution

-b batch_size Specifies the number of rows per batch of imported data. [BOL]

The parameter changes import batch size only. I'm not aware of anyway to change the export row count reporting.

Context

StackExchange Database Administrators Q#152116, answer score: 14

Revisions (0)

No revisions yet.