bcp

Copies a database table to or from an operating system file in a user-specified format.

bcp provides a convenient and high-speed method for transferring data between a database table or view and an operating system file. bcp can read or write files in a wide variety of formats. When copying in from a file, bcp inserts data into an existing database table; when copying out to a file, bcp overwrites any previous contents of the file.

The utility is located in:
  • (UNIX) $SYBASE/$SYBASE_OCS/bin.

  • (Windows) %SYBASE%\%SYBASE_OCS%\bin, as bcp.exe.

Note: For parallel bcp, on:
  • UNIX platforms – use bcp_r. The executable is in the same directory as the standard bcp command.

  • Windows – use the standard bcp.exe utility.

Syntax

bcp [[database_name.]owner.]table_name [: partition_id | slice_number 
	[partition partition_name] {in | out} [datafile] 
	[-a display_charset]
	[-A packet_size]	
	[-b batch_size]
	[-c]
	[-C]
	[-d discardfileprefix]
	[-e errfile] 
	[-E]
	[-f formatfile] 
	[-F firstrow]
	[-g id_start_value]
	[-i input_file]
	[-I interfaces_file]
	[-J client_character_set]
	[-K keytab_file] 
	[-L lastrow]
	[-m maxerrors]
	[-MLabelName LabelValue] [-labeled]
	[-n]
	[-N]
	[-o output_file]
	[-P password]
	[-Q]
	[-r row_terminator] 
	[-R remote_server_principal]
	[-S server]
	[-t field_terminator]
	[-T text_or_image_size]
	[-U username] 
	[-v]
	[-V [security_options]]
	[-W]
	[-x trusted.txt_file]
	[-X]
	[-y alternate_home_directory] 
	[-Y ]
	[-z language] 
	[-Z security_mechanism]
	[--colpasswd [[[db_name.[owner].]table_name.]
							column_name [password]]]
	[--keypasswd [[db_name.[owner].]key_name [password]]]
	[--hide-vcc]
	[--initstring "TSQL_command"]
	[--maxconn maximum_connections]
	[--show-fi]
	[--skiprows nSkipRows]

Parameters

Examples

Permissions

You must have an SAP ASE account and the appropriate permissions on the database tables or views, as well as the operating system files to use in the transfer to use bcp.

  • To copy data into a table, you must have insert permission on the table.

  • To copy a table to an operating system file, you must have select permission on these tables:
    • The table to copy

    • sysobjects

    • syscolumns

    • sysindexes

Auditing

Values in event and extrainfo columns are:

Event

Audit option

Command or access audited

Information in extrainfo

4

bcp

bcp in

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – NULL

  • Proxy information – Original login name, if set proxy in effect

Tables used

sysaudits_01 – sysaudits_08

Related concepts
Using bcp to Transfer Data to and from SAP ASE
Bulk Copying Encrypted Data
Threaded Versions of Utilities
Utility Commands Reference
Database Creation and Manipulation Utilities