IBCPSession::BCPWriteFmt (Native Client OLE DB Provider)

Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)


The SQL Server Native Client (often abbreviated SNAC) has been removed from SQL Server 2022 (16.x) and SQL Server Management Studio 19 (SSMS). Both the SQL Server Native Client OLE DB provider (SQLNCLI or SQLNCLI11) and the legacy Microsoft OLE DB Provider for SQL Server (SQLOLEDB) are not recommended for new development. Switch to the new Microsoft OLE DB Driver (MSOLEDBSQL) for SQL Server going forward.

Writes format information for each column to the format file.


      const wchar_t *pwszFormatFile);  


The format file specifies the data format of a data file created by bulk copy. Calls to the IBCPSession::BCPColumns and IBCPSession::BCPColFmt methods define the format of the data file. The BCPWriteFmt method saves this definition in the file referenced by the pwszFormatFile argument.

The BCPWriteFmt method can save the format files in either xml or text format. This must be indicated by using the BCP_OPTION_XML control option with the IBCPSession::BCPControl method.

To load a saved format file, use the IBCPSession::BCPReadFmt method.


The path and file name of the file containing the format values for the data file.

Return Code Values

The method succeeded.

A provider-specific error occurred; for detailed information, use the ISQLServerErrorInfo interface.

Out-of-memory error.

The call to the method was unexpected. For example, the IBCPSession::BCPInit method was not called before calling this method.

See Also

IBCPSession (OLE DB)
Performing Bulk Copy Operations