Importing and Exporting Data

With the bulk copy program (bcp), you can easily import data from other applications or export data to those applications. For example, you can import data from Microsoft® Visual FoxPro™, or you can export a view based on several tables for use in other SQL Servers or for analysis in Microsoft Excel.

The bulk copy program (bcp) copies SQL Server data to or from an operating-system file in a user-specified format.

The bcp utility is most frequently used to transfer data into a SQL Server database from another program, usually another database management system. The data to be transferred must be put into an operating-system file or onto a diskette with a backup facility provided by the old program.

The bcp utility is also used for temporary transfers of data for use with other programs¾for example, with spreadsheet programs. The data is moved from SQL Server into an operating-system file or onto a diskette; from there, the other program can import the data.

SQL Server can accept data in any ASCII or binary format as long as the terminators (the characters used to separate columns and rows) can be described. The table structures need not be identical. Data copied into SQL Server is appended to any existing contents of a table; data copied to a file overwrites any previous contents of the file.

To use bcp, a user must have a SQL Server login account and the appropriate permissions on the database tables, views, and operating-system files.

For details on bcp, see the Microsoft SQL Server Administrator's Companion and the bcp command-line utility in the Microsoft SQL Server Transact-SQL Reference.