-1

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)

DVK
  • 126,886
  • 32
  • 213
  • 327
  • 1
    if your program can connect to Sybase ASE then check to see if your program (via it's connectivity libs) can support ASE's bulk insert api (this is going to be a lot faster than inserts - with or without prepared statements); on the other hand, if you really need to create a data file to be supplied to bcp (at a later date), your easiest option would be to write the data to a delimited file – markp-fuso Jul 21 '20 at 22:35
  • Is bulk insert API what bcp uses? If not how do they compare in speed? @markp-fuso – DVK Jul 22 '20 at 00:36
  • `bcp` and ASE are built from the same SDK so yes, the `bcp` and the bulk insert API are going to be comparable – markp-fuso Jul 22 '20 at 00:55

2 Answers2

0

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.

Rich Campbell
  • 566
  • 2
  • 9
-1

İ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