0

I use bcp to copy Sybase IQ table to sybase ASE server. Actually bcp first creates some bulk file with extracdet sybase IQ table there, and after just loads that file to Sybase ASE. Is it the one and the best (considering accuracy, speed) way to do that?

1
  • You might be able to use a named pipe in between the two - I can't remember if bcp needs to do a seek at all ...
    – Philᵀᴹ
    Mar 18, 2015 at 8:15

1 Answer 1

1

IQ has the ability to output data directly from the data server to a local filesystem. It's faster than returning data over the network to a client tool. Create the output file that way, and then bulkcopy it into Sybase ASE using bcp -c :

set temporary option Temp_Extract_Name1='my_output_file';
-- Set column tab delimiter via hex value for use by bcp -c
-- Note, character between the single quotes needs to be an actual
-- tab character. \t and \0x09 don't work.  Might need to be 
-- in a script where you can insert a tab character using vi or 
-- something similar.  Stupid IQ.
set temporary option TEMP_EXTRACT_COLUMN_DELIMITER=' ';
select * from my_table;
set temporary option Temp_Extract_Name1='';

This should produce a file that in a suitable format for bcp with the -c option. Be careful about tabs embedded in the data. I'm not sure if they'll be escaped.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.