BCP or the Bulk Copy Program is a utility that is provided in Sybase ASE to help the developer get a table's data as output to a file. With the use of bcp utility we can get the data from a table into a file and restore this data back into the table at any later stage.
The bcp command can be used to input and output data from a file to a Sybase table or vice-versa. This is suggested via the use of two keywords - in and out for input and output respectively. The syntax for bcp utility is as follows -
For native mode -
bcp DATABASENAME.OWNERNAME.TABLENAME out “File Path with File Name within quotes” –SSERVERNAME –ULOGINNAME –PPASSWORD –t, -n
For character mode –
bcp DATABASENAME.OWNERNAME.TABLENAME out “File Path with File Name within quotes” –SSERVERNAME –ULOGINNAME –PPASSWORD –t, -c
As mentioned above in case we need to output the result in character mode then we need to use -c option in the bcp command however if we need to output the data in native mode then we use the -n option. Apart from this basic syntax we can also define format file for the data transfer using the -f option.
bcp for sybase
ReplyDelete