You work at the regional sales office. You are responsible for importing and exporting data in SQL Server 2005 databases. The main office asks you to send them a text file that contains updated contact information for the customers in your region. The database administrator in the main office asks that the data be sorted by the StateProvince, Surname, and FirstName columns.
You need to satisfy these requirements by using the least amount of effort. What should you do?
A.
Specify StateProvince, Surname, and FirstName in the ORDER hint in the bcp out command.
B.
Create a format file for the export operation.
C.
Specify StateProvince, Surname, and FirstName in the ORDER BY clause in the bcp queryout command.
D.
Copy the data into a new table that has a clustered index on StateProvince, Surname, and FirstName. Export the data.
Explanation:
The bcp utility bulk copies data between an instance of Microsoft SQL Server 2005 and a data file in a user-specified format. The bcputility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files. Except when used with the queryout option, the utility requires no knowledge of Transact-SQL. Queryout copies from a query and must be specified only when bulk copying data from a query.
Syntax:bcp {[[database_name.][owner].]{table_name | view_name} | "query"} {in | out | queryout | format} data_file [-mmax_errors] [-fformat_file] [-x] [-eerr_file] [-Ffirst_row] [-Llast_row] [-bbatch_size] [-n] [-c] [-N] [-w] [-V (60 | 65 | 70 | 80)] [-6] [-q] [-C { ACP | OEM | RAW | code_page } ] [-tfield_term] [-rrow_term] [-iinput_file] [-ooutput_file] [-apacket_size] [-Sserver_name[instance_name]] [-Ulogin_id] [-Ppassword] [-T] [-v] [-R] [-k] [-E] [-h"hint [,…n]"]