首页 >计算机类 >微软认证 > >You are the administrator of a SQL Server 2000 computer in your company's personnel department. Employee data is stored in a SQL Server 2000 database. A portion of the database schema is shown in the

You are the administrator of a SQL Server 2000 computer in your company's personnel department. Employee data is stored in a SQL Server 2000 database. A portion of the database schema is shown in the

时间:2019-11-03 06:55浏览次数:

You want to create a text file that lists these data columns in the following format title, FirstName, LastName, WorkPhone, PositionName, DepartmentName.

You want to create the text file as quickly as possible. You do not expect to re-create this file, and you want to avoid creating new database objects if possible.

What should you do?

A.Use the bcp utility to export data from each table to a separate text file. Use format files to select the appropriate columns. Merge the data from each text file into a single text file.

B.Create a view that joins data from all three tables include only the columns you want to appear in the text file. Use the bcp utility to export data from the view.

C.Create a SELECT query that joins the data from the appropriate columns in the three tables. Add an INTO clause to the query to create a local temporary table. Use the bcp utility to export data from the local temporary table to a text file.

D.Create a SELECT query that joins the data from the appropriate columns in the three tables. Add an INTO clause to the query to create a global temporary table. Use the bcp utility to export data from the global temporary table to a text file.

参考答案

正确答案:D
解析:Explanation:Asthecolumnsthatwewantinthetextfileareondifferenttablesinthedatabase,wewouldhavetocombinethecolumnintoatableorview.Becausewewillnotneedtoreproducethefile,wecanwecancombinethecolumnfromthevarioustablesintoaglobaltemporarytablebyusingtheSELECTINTOstatement.Thenweusethebcputilitytoexportthedatafromtheglobaltemporaryfiletoatextfile.Note:Temporarytablesarenotstoredinthecurrentdatabase;theyarestoredinthetempdbsystem.Therearetwotypesoftemporarytables:localtemporarytables,whicharevisibleonlytotheconnectionthatcreatedthem,andglobaltemporarytables,thatarevisibletoallconnections.Ifglobaltemporarytablesarenotdroppedexplicitlybeforetheconnectionthatcreatedthemdisconnects,theyaredroppedassoonasallothertasksstopreferencingthem.Nonewtaskscanreferenceaglobaltemporarytableaftertheconnectionthatcreateditdisconnects.ThebcputilitycopiesdatabetweenaninstanceofSQLServer2000andadatafileinauser-specifiedformat.ItcanbeusedtotransferdatafromaSQLServertabletoadatafileforuseinotherprograms.Furthermore,datacanalsobetransferredoutbyspecifyingaSELECTstatement.Thebcputilitycanuseglobaltemporarytables,butnotlocaltemporarytables.IncorrectAnswers:A:CreatingaglobaltemporarytablebyusingtheSELECTstatementandusingthebcputilitytoexportdatafromthattablewouldrequirelessadministrativeeffortthanusingbcptoexporttherequiredcolumnsfromeachtableintoaseparatetextfileandthenmergingthosetextfilesintoasingletextfile.B:Becausewewouldnotneedtore-createthedatafileagain,itwouldbeeasiertousetheSELECTstatementtocreateaglobaltemporarytableasthesetablesaredroppedautomaticallywhennothingreferencethem.C:Thebcputilitycannotuselocaltemporarytables.Note:Temporarytablesarenotstoredinthecurrentdatabase;theyarestoredinthetempdbsystem.Therearetwotypesoftemporarytables:localtemporarytables,whicharevisibleonlytotheconnectionthatcreatedthem,andglobaltemporarytables,thatarevisibletoallconnections.

    阅读排行