The BCP utility replicates data in the format specified by the Microsoft® SQL ServerTM 2000 instance and data files.
Syntax BCP {[[Database_name.] [Owner].] {Table_name | View_name} | "query"} ??? {in | out | queryout | format} Data_File ??? [-m max_errors] [-f format_file] [ -e err_file] ??? [-f first_row] [-l last_row] ??? [-n] [-c] [-w] [-n] [-V (60 | 65 | 70 )] [-6] ??? [-q] [-c code_page] [-t field_term] [-r row_term] ??? [-i infut_file] [-o output_file] ??? [-A packet_size] ??? [ -S server_name [/ instance] [-u login_id] [-p Password] ??? [-t] [-v] [-r] [-k] [-e] [-h "hint [, .. .n] "]
The value of the calculated column or TimeStAMP column will be ignored in the data file to be imported, and the SQL Server 2000 automatically assigns. If the data file does not include the value of the calculated column or TimeStAMP column, the available format file specifies the calculation column and the TimeStAMP column that should be skipped in the table when importing data; SQL Server will automatically assign the column.
Calculating columns and TimeStamp columns often copied from SQL Server to a data file.
SQL Server identifiers (including database names, table names, or view names, login, and passwords) can include characters such as embedded spaces and quotes. When the identifier or file name containing a space or quotation is specified at the command prompt, it is necessary to cross the identifier in double quotes (""). In addition, for the name of the owner, table or view of the embedded space or quotation, the -Q option can be specified, or the name of the owner, the table, or the view is enclosed in both brackets ([]) in double quotes.
For example, there is a table Jane's ORDERS in the Northwind database, which is owned by the user Jane Doe. To use the login Jane DoE and password Go DBA to copy the table from the NorthWind database to the Orders.txt file, perform one of the following commands:
BCP "Northwind.jane Doe.jane's Orders" OUT "Jane's ORDERS.TXT" -c -q -u "jane doe" -p "go dba"
BCP "Northwind. [Jane's Orders]" Out "Jane's Orders.txt" -c -u "jane doe" -p "go dba"
/ / BCP? You can implement data import export. ? EXEC? MASTER..XP_CMDSHELL? 'Bcp? Northwind.dbo.tt? In? C: /Temp1.txt? -C? -Q? -S "gengw"? -U "sa"? -P ""? // Import ???? EXEC? Master..xp_cmdshell? 'Bcp? Pubs.dbo.authors? Out? C: /TEMP1.TXT? -C? -Q? -S "gengw"? -U "sa"? -P ""? // Export?