BUG: Bcp.exe Executes Query Twice When QueryOut Argument Used (309555)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q309555
BUG #: 355023 (SHILOH_BUGS)
BUG #: 74204 (MDAC)

SYMPTOMS

Exporting rows from a table by using the bcp utility takes longer than expected when you specify the QueryOut argument to provide selective criteria when retrieving rows.

CAUSE

The query specified in the bcp statement executes twice, which results in twice the amount of Reads and Writes and can double the execution time of the operation.

WORKAROUND

Avoid use of the QueryOut argument when you export rows with the bcp utility. To export selective data, create a view and base it on the original query specified in the bcp operation. Next, use the Out argument instead of the QueryOut argument to bulk-copy the view.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 2000.

Modification Type:MajorLast Reviewed:9/25/2003
Keywords:kbbug kbpending KB309555