Reads a data file format definition from a user file for a bulk copy between a file and Microsoft® SQL Server™ 2000.
RETCODE bcp_readfmt (
LPCSTR file_name );
Is the DBPROCESS structure that is the handle for a particular workstation or SQL Server process. It contains all the information that DB-Library uses to manage communications and data between the workstation and SQL Server.
Is the full directory and file name specification of the file containing the format definitions.
SUCCEED or FAIL.
After bcp_readfmt reads a data file 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 about the bcp utility and definition files for datafile format, see Transact-SQL Reference.
Applications can call bcp_writefmt to create files that define data file 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);