BCP utility in Sybase(Unix Env

We can use below command for bcp out a table to *.dat file,

$SYB_BIN/bcp hnwreport.dbo.TblHNWCustomer out ${SYB_DATA}/${TABLE}.prod.dat -I/opt/muni/HNWEnv/HNW_interfaces.txt -U hnwuser -P Lip0v123 -S STEP_PROD_NY_DS –t’|’ -b 10000 -e${ERRFILE} -T –c

Please be vigilant that if you want to use self-defined interface file rather than default system interface, you have to use –I option and define interface file in place.

If you want to use bcp utility, you can export Sybase,

export SYBASE=/optware/aseclient1503x/ase155b/

$SYBASE/OCS-15_0/bin/bcp hnwreport.dbo.TblHNWCustomer out /opt/HNW/HNWFileAnalysis/HNWOutput/TEST.dat -I/opt/muni/HNWEnv/HNW_interfaces.txt -U hnwuser -P Lip0v123 -S STEP_PROD_NY_DS -t'|' -b 10000 -e${ERRFILE} -T –c

$SYBASE/OCS-15_0/bin/isql -I/opt/muni/HNWEnv/HNW_interfaces.txt -U hnwuser -P Lip0v123 -S STEP_PROD_NY_DS < /tmp/test.sql