how to specify row delimiter when using bcp with a format file

前端 未结 2 1523
攒了一身酷
攒了一身酷 2020-12-22 00:22

I am using bcp utility to import data into Sybase database on Solaris system

Since the bcp file is generated by another xml pa

2条回答
  •  生来不讨喜
    2020-12-22 00:54

    Sybase format files can be tricky to use, and I have yet to get them to work to redorder columns. Without a format file, and since you can not control the input file you're given, your options are:

    1. Rebuild the table with the columns in the correct order
    2. Use a temp table, or work table for the bcp in, and move the data into your production table from there.
    3. If for some reason there is logic in place the requires the table to keep it's existing column order (which should be unlikely), you can rebuild the table with the correct column order, then create a view of the table that has the columns in the old order.

    Given your data format, the following bcp command line should work.

    bcp DBNAME..TABLENAME in MY_FILE.bcp -U username -P password -S SERVERNAME -c -t\| -r\\n
    

提交回复
热议问题