BCP to ignore different columns order in format file and target database
One of declared reason of using format file is "The column order is different for the data file and table.". But it still doesn't work this way. I have differences in column order, because second database being patched with dacpac diffs (with first database) with option "ignore column order" to prevent table recreation. Everything else absolutely the same between tables.
bcp DB2.dbo.Table1 in C:\Temp\dbo_Table1.bcp -CRAW -q -E -k -h "TABLOCK" -fC:\Temp\dbo_Table1.fmt -t"|~~|" -r\r\r\n\n -S"Server1" -T
and I get:
SQLState = S1002
NativeError = 0
Error = [Microsoft][ODBC Driver 11 for SQL Server]Invalid Descriptor Index
It works only if I reorder columns in destination database to match the source database.
Same problem described here https://stackoverflow.com/questions/30412295/using-bcp-exe-to-successfully-import-data-even-if-the-column-order-in-the-forma