Reads a datafile format definition from a user file for a bulk copy between a file and SQL Server.
RETCODE bcp_readfmt (
PDBPROCESS dbproc,
LPCSTR filename );
where
SUCCEED or FAIL.
After bcp_readfmt reads a datafile format definition from a host file, it makes the appropriate calls to bcp_columns and bcp_colfmt. These calls automate the bulk copy of multiple files that share a common data format.
The bulk copy utility (bcp) copies a database table to or from a host file in a user-specified format, which can be saved with bcp in definition files for datafile format. These files can later automate the process of bulk copying files that share a common format. For more information on the bcp utility and definition files for datafile format, see the Microsoft SQL Server Transact-SQL Reference.
Applications can call bcp_writefmt to create files that define datafile formats.
Note The format file cannot have been produced by a version of the bcp utility program earlier than version 4.2.
The following code fragment shows how to use bcp_readfmt:
bcp_init(dbproc, "mytable", "bcpdata", "bcperrs", DB_IN); bcp_readfmt(dbproc, "my_fmtfile"); bcp_exec(dbproc, &rows_copied);
bcp_colfmt, bcp_columns, bcp_writefmt