How can I create native Sybase BCP file?

438 Views Asked by At

I have data in my program's memory, that I need to import into a database.

For performance reasons I would like to do it via Sybase BCP, specifically using native file format.

Challenge: I need to know what the native Sybase BCP file format is, and it does not seem to be documented anywhere.

Is there a good documentaion for it? Examples of logic to create one?

(I know I can somewhat easily create character BCP file, but that is slower than native format)

2

There are 2 best solutions below

0
On

İf data in your program's memory are too big You can use/try Load table command for Sybase IQ (only Sybase IQ, not for Sybase ASE). also Load table command faster than bcp

0
On

Native format is a binary format which cannot be converted to/from text and is created by using BCP with -n instead of -c. Other than that the means to do it is identical and the delimiters and other options work the same for both character and native. It's not documented because its a proprietary format which they own.

If you have a existing character file you need to load though you will have to use character format to load the file - you cannot convert your character file into native format or back again. The only workaround would be loading it into a Sybase database as char, BCP out as native and then BCP in again native, which would be slower than just using char format to begin with.

If you drop indexes on your target table, it will also be massively faster to load your BCP file but you must then re-create them afterwards (and update index statistics where necessary). You also need the 'select into/bulk copy' option set on your database to allow this fast method of BCP as it's a minimally logged operation.