Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the order in the data files exported from tables by BCP

Status
Not open for further replies.

shanghai2004

Programmer
Dec 16, 2004
37
CA
Dear Expert,

I use BCP to export data from tables in one database and then import the data files to the same tables in another database with different collation.

What is the row order in the data files exported from a table? Should the row order in destination table have the same order as in data file if I don't specify any order in BCP command (in)?

I have trouble to verify the BCP results. Less then 4% tables have the row orders different from the source tables (most tables only have one row in different order).

An export suggested me to download a 14 day trial version of redgate's data compare, but my company does not allow me to download or buy any applications. Is there a way to create .sql file to do the work?

Thanks

A poor programmer
 
Not wanting to be unhelpful, but why does it matter? But if it really does, I think that if the table has a primary key specified, the rows generally come out in that order.
 
I assume you are talking about identity values and if you are not then ignore this
if you want the same exact order
put the identity values in the files
when you do an insert use SET IDENTITY INSERT ON that way you will have the same exact identity values in both tables
And make sure you use SET IDENTITY INSERT OFF after the import

Denis The SQL Menace
SQL blog:
Personal Blog:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top