Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8540

Re: Getting started with BCP

$
0
0

I'd suggest a couple options:

 

----------------------- option #1

 

Your *fmt file is likely not correct. "Duh, Mark!" ?

 

NOTE: I don't normally use format files so I don't recall (off the top of my head) the proper/correct format of the *fmt file, so short of re-reading the manuals I use the following method to generate a properly/correctly formatted *fmt file:

 

- use the INSERT command to populate the Sybase table with a few of your data values (4-digit, 5-digit, 8-digit, etc)

 

- use bcp to pull the data from your table and have bcp create the *fmt file for you

 

- try using the *fmt file (created by bcp/out) to bcp your data file into the table

 

----------------------- option #2

 

Since your data file is just integers with a <lf>, consider skipping the format file ...

 

bcp dbname.owner.TO_INTS in "SomeInts.txt" -P password -S server -U sa -c -r "\n" -e "bcp.errlog.txt"


The -r option allows you to designate the row delimiter.


NOTE: To be honest I don't recall (off the top of my head, again) if <lf> is '\n' or '\r' or '\n\r' or '\r\n', so try each to see which works best. I usually use the UNIX 'od' command to verify the line terminator.  I'd suggest using a small file (eg, 5-10 values) to make sure you've got the right -r setting before trying to load a huge data set.


NOTE: The -t option allows you to define the column delimiter, eg, -t '\t' says you've got a tab between each column.


Viewing all articles
Browse latest Browse all 8540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>