Does bcp out maintain row order while exporting into a data file?

bcp, sql-server-2005

Solution

I think it will if you use a sql statement (with `ORDER BY`) in your bcp command:

http://www.sqlteam.com/article/exporting-data-programatically-with-bcp-and-xp_cmdshell

where they have the following example:

SET @bcpCommand = 'bcp "SELECT * FROM pubs..authors 
   ORDER BY au_lname" queryout "' 

Problem

I need to export data to a file from a huge table with only one column but thousands of rows where the ordering of row is important. I am using bcp command as below `bcp DBNAME.dbo.tblName out mydata.dat -Uusername -Ppassword -c` I checked with the table having 10 rows and I see that the order of the rows is maintained in the data file. But can I assume bcp would maintain the order if the number of rows is say more than 10000?

Original source