You are a database administrator for your company.
You transfer data from the Prod1 database maintained onthe Sql1 instance of SQL Server 2008 into an external data file before sending the data file to vendors.
You mustsend all the data from the Tbl_auction_rate table. You must use the bcp utility to accomplish this.
Which two bcp commands could you use to accomplish this? (Choose two. Each correct answer represents acomplete solution.)
A.
bcp "SELECT * FROM Prod1.dbo.Tbl_auction_rate" sql c:Auctionrates.dat -c -T
B.
bcp "SELECT * FROM Prod1.dbo.Tbl_auction_rate" queryout c:Auctionrates.dat -c -T
C.
bcp Prod1.dbo.Tbl_auction_rate out c:Auctionrates.dat -c -T
D.
bcp "SELECT * FROM Prod1.dbo.Tbl_auction_rate" out c:Auctionrates.dat c -T
E.
bcp Prod1.dbo.Tbl_auction_rate sql c:Auctionrates.dat -c -T
Explanation:
You could execute either of the following bcp commands: bcp "SELECT * FROM Prod1.dbo.Tbl_auction_rate" queryout c:Auctionrates.dat -c -T bcp Prod1.dbo.Tbl_auction_rate out c:Auctionrates.dat -c -T The bcp utility is used to copy data from and copy data into SQL Server. The bcp utility is typically used to importdelimited files or XML data into a database. You can also use the bcp utility to export data. You can specify theformat of the file you are importing by creating format files. The bcp utility can be used to create format files. Itcan also create XML format files for XML data. In this scenario, the following command will export all the rows from the Tbl_auction_rate table to the c:Auctionrates.dat file: bcp "SELECT * FROM Prod1.dbo.Tbl_auction_rate" queryout c:Auctionrates.dat -c -T This statement specifies a Transact-SQL query that selects a result set containing all table rows from the Prod1.dbo.Tbl_auction_rate table. The result set output is then directed to the c:Auctionrates.dat file by usingthe queryout argument. The queryout argument is specified when you want to perform a bulk copy operationby executing a Transact-SQL query. The following statement will also export all rows from the Tbl_auction_rate table to the c:Auctionrates.dat file: bcp Prod1.dbo.Tbl_auction_rate out c:Auctionrates.dat -c -T This statement specifies the name of the table from which the rows will be exported. The out argument specifiesthat the contents are copied from a database table or a view to a file. The following option is incorrect because sql is not a valid argument for the bcp utility: bcp "SELECT * FROM Prod1.dbo.Tbl_auction_rate" sql c:Auctionrates.dat -c -T The following option is incorrect because you cannot execute a Transact-SQL query with the out argument: bcp "SELECT * FROM Prod1.dbo.Tbl_auction_rate" out c:Auctionrates.dat -c -T You must use the queryout argument if you specify a Transact-SQL query. The following option is incorrect because sql is not a valid argument specified for the bcp utility: bcp Prod1.dbo.Tbl_auction_rate sql c:auctionrates.dat -c -T
Objective:
Performing Data Management TasksSub-Objective:
Import and export data.References:
TechNet > TechNet Library > Server Products and Technologies > SQL Server > SQL Server 2008 > ProductDocumentation > SQL Server 2008 Books Online > Database Engine > Technical Reference > Tools Reference >Command Prompt Utilities > bcp Utility