单选题You are creating a stored procedure that will delete data from the Contact table in a SQL Server 2005 database. The stored procedure includes the following Transact-SQL statement to handle any errors that occur. BEGIN TRY   BEGIN TRANSACTION   DELETE FROM Person.Contact WHERE ContactID = @ContactID COMMIT TRANSACTION END TRY   BEGIN CATCH   DECLARE @ErrorMessage nvarchar(2000) DECLARE @ErrorSeverity int DECLARE @ErrorState int SELECT @ErrorMessage = ERROR MESSAGE(),@ErrorSeverity=ERROR SEVERITY(),@ErrorState = ERROR STATE() RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState) END CATCH;      You test the stored procedure and discover that it leaves open transactions. You need to modify the stored procedure so that it properly handles the open transactions. What should you do?()AAdd a COMMIT TRANSACTION command to the CATCH block.BRemove the COMMIT TRANSACTION command from the TRY block.CAdd a ROLLBACK TRANSACTION command to the CATCH block.DAdd a ROLLBACK TRANSACTION command to the TRY block.

单选题
You are creating a stored procedure that will delete data from the Contact table in a SQL Server 2005 database. The stored procedure includes the following Transact-SQL statement to handle any errors that occur. BEGIN TRY   BEGIN TRANSACTION   DELETE FROM Person.Contact WHERE ContactID = @ContactID COMMIT TRANSACTION END TRY   BEGIN CATCH   DECLARE @ErrorMessage nvarchar(2000) DECLARE @ErrorSeverity int DECLARE @ErrorState int SELECT @ErrorMessage = ERROR MESSAGE(),@ErrorSeverity=ERROR SEVERITY(),@ErrorState = ERROR STATE() RAISERROR (@ErrorMessage, @ErrorSeverity, @ErrorState) END CATCH;      You test the stored procedure and discover that it leaves open transactions. You need to modify the stored procedure so that it properly handles the open transactions. What should you do?()
A

Add a COMMIT TRANSACTION command to the CATCH block.

B

Remove the COMMIT TRANSACTION command from the TRY block.

C

Add a ROLLBACK TRANSACTION command to the CATCH block.

D

Add a ROLLBACK TRANSACTION command to the TRY block.


参考解析

解析: 暂无解析

相关考题:

You are the administrator of a SQL Server 2000 computer. The server contains confidential information about contracts on which your company has placed bids.Company policy requires that bid information be removed permanently from the database one year after the bid closes. You need to comply with this policy and minimize server overhead.What should you do?A.Create a Data Transformation Services (DTS) package to remove bids that have a closing data older than one year.B.Create a trigger to delete any bids that have a closing data older than one year. Bind the trigger to the bids table for all INSERT, UPDATE, and DELETE events.C.Create a stored procedure to delete any bids that have a closing data order than one year. Use SQL server agent to schedule the stored procedure to run every night.D.Create a view that contains a WHERE clause to exclude bids that have a closing date older than one year.

You are the administrator of a SQL Server 2000 database. Using the default options configures the database. You drop indexes to facilitate a large import of data, and rebuild them after the import is complete.Users report that response times from a stored procedure have become slower. In the stored procedure, you examine the following code.CREATE PROCEDURE GetCustomer( @CustomerID Int )ASSELECT FirstName, LastName, Address1, Address2, City,State, Zip, MAX(PurchaseDate) AS LastPurchaseFROM Customers CJOIN Addresses A ON A.AddressID = C.AddressIDJOIN Purchases P ON P.CustomerID = C.CustomerIDWHERE C.CustomerID = @CustomerIDGROUP BY FirstName, LastName, Address1, Address2, City, State, ZipYou want to improve the performance of the procedure by using the least amount of administrative effort. What should you do?A.Recompile the stored procedure.B.Update the database statistics.C.Check the consistency of the database and repair errors.D.Create a view and modify the stored procedure to use the view.

You delete content from a file named Speed.doc that is stored in the C:\Data folder. You edit 20 files in this folder over the next two days. You need to restore the version of the file that had the correct data. You also need to ensure that the other fiels in the folder remain unaffected.What should you do?()A.AB.BC.CD.D

Consider the Mysql Enterprise Audit plugin. A CSV file called data.csv has 100 rows of data. The stored procedure prepare_db ( ) has 10 auditable statements. You run the following statements in the mydb database: Mysql> CALL prepare_db ( ); Mysql> LOAD DATA INFILE '/tmp/data.cav' INTO TABLE mytable; Mysql> SHOW TABLES; How many events are added to the audit log as a result of the preceding statements?()A、12; only top-level statements and stored procedure events are loggedB、111; top-level statements and all lower-level statements are loggedC、3; only the top-level statements are loggedD、102; top-level statements are logged, but LOAD DATA INFILE is logged as a separate event

The accounting manager wants you to create a form that when queried will display a calculated total of year-to-date actual expenditures for the found code entered. The values needed to generate this summary data are stored in multiple tables. Which data source type can you assign to the data block for this form without having the DBA create a database object?()A、database table B、transactional trigger C、stored procedure D、FROM clause query E、client-side procedure

You need to cleanse and standardize the data on potential survey participants prior to inserting it into the staging database. What should you do?()A、Import the data into a staging table by using the OPENROWSET BULK statement. Execute a Transact-SQL stored procedure to cleanse the data and to insert the data into the database.B、Import the data into a staging table by using the BULK INSERT statement. Execute a Transact-SQL stored procedure to cleanse the data and to insert the data into the database.C、Create a SQL Server Integration Services (SSIS) package to import, standardize, and cleanse the data.D、Create a CLR stored procedure to import the data into a staging table, to cleanse and standardize the data, and to insert the data into the database.

You work in a company which uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a remote SQL Server 2008 instance. You notice that the application has a poor performance. On the remote SQL Server instance, you capture a workload of the remote instance to a trace table by using SQL Profiler. Now you have to use the Database Engine Tuning Advisor to analyze the workload of the remote SQL Server instance on a local SQL Server instance.  So what action should you perform to achieve this goal?()A、You should recapture the workload by using the data collector.B、You should enable the XP_MSVER stored procedure on the local server.C、You should enable the XP_MSVER stored procedure on the remote serverD、You should recapture the workload to a trace file by using SQL Profiler.

You work in a company which uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. There is a stored procedure. The stored procedure implements a database maintenance process. A SQL Server Agent job should be created to that runs the stored procedure. Besides this, you must make sure that after it is completed successfully, the job is removed.  What should you do? ()A、You should create a job which is assigned to the Database Maintenance categoryB、You should create an Alert which will run another to delete the maintenance job.C、You should create a job. You schedule the job to run only once.D、You should create a job. The job uses the Automatically delete job option

You are designing the loan application process for the customer terminals. You need to design a Transact-SQL stored procedure that fulfills the business and technical requirements. Which type of Transact-SQL stored procedure should you use?()A、one that uses an internal SQL Server Web service endpointB、one that runs a SQL Server Integration Services (SSIS) packageC、one that uses Service BrokerD、one that runs a user-defined function

You work in a company which is named Wiikigo Corp. The company uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. There is a database named DB1 in the instance. DB1 has a table which is named Table01 and a stored procedure named Procedure01. Procedure01 choose data from Table01 by using a sp_executesql Transact-SQL statement. You company security rules forbid users to access tables directly in any database. Look at the exception below: "Msg 229, Level 14, State 5, Line 1 The SELECT permission was denied on the object 'Table01', database 'DB1', schema 'dbo'." The exception is raised when Procedure01 is executed by users. You must make sure that e user can successfully execute Procedure1 complying with the company rules. So what action should you perform to achieve this goal?()  A、You should execute the GRANT SELECT ON dbo.Table01 TO User1 Transact-SQL statement. B、You should execute the GRANT EXECUTE ON dbo.Procedure1 TO User1 Transact-SQL statement. C、You should alter Procedure01 and add the WITH EXECUTE AS OWNER option to its header D、You should alter Procedure01 and add the EXECUTE AS USER = apos;dboapos; option immediately before the call to the sp_executesql stored procedure.

A Windows Azure application stores data in a SQL Azure database.  The application will start an operation that includes three insert statements.  You need to recommend an approach for rolling back the entire operation if the connection to SQL Azure is lost.  What should you recommend?()A、 Ensure that all statements execute in the same database transaction.B、 Create a stored procedure in the database that wraps the insert statements in a TRY CATCH block.C、 Create a stored procedure in the database that wraps the insertstatements in a TRANSACTION block.D、 Open a new connection to the database. Use a separate transaction scope to roll back the original operation.

You work in a company which is named Wiikigo Corp. The company uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. There is a report which is often executed during business time. There is a stored procedure that is used as the data source for the report. You get a report from users saying that they receive the data returned by the report but the data is inconsistent. As the technical support, you check and find that phantom reads cause this problem. You must make sure that consistent data is returned by the report while not affecting other users. So what action should you perform to achieve this goal?()  A、You should configure the database for Read Committed Snapshot isolation. B、You should modify the stored procedure to use the Snapshot isolation level C、You should configure the database for Auto Update Statistics asynchronously D、You should modify the stored procedure to use the Repeatable Read isolation level

You are creating a Web Form. The Web Form allows users to rename or delete products in a list. You create a DataTable named dtProducts that is bound to a GridView. DataTable has the following four rows. dtProducts. Rows[0]["ProductName"] = “Soap”;dtProducts. Rows[1][“ProductName”]= “Book”;dtProducts. Rows[2][“ProductName”]= “Computer”;dtProducts. Rows[3][“ProductName”]= “Spoon”;dtProducts. AcceptChanges( ); The user utilizes a Web Form to delete the first product. You need to set the RowStateFilter property of the DataTables DefaultView so that only products that have not been deleted are shown. To which value should you set the DataTabless DefaultView.RowStateFilter? ()A、Data V iewRowState.ModifiedOriginal;B、Data V iewRowState.ModifiedCurrent;C、Data V iewRowState.CurrentRows;D、Data V iewRowState.Added;

单选题A Windows Azure application stores data in a SQL Azure database.  The application will start an operation that includes three insert statements.  You need to recommend an approach for rolling back the entire operation if the connection to SQL Azure is lost.  What should you recommend?()A Ensure that all statements execute in the same database transaction.B Create a stored procedure in the database that wraps the insert statements in a TRY CATCH block.C Create a stored procedure in the database that wraps the insertstatements in a TRANSACTION block.D Open a new connection to the database. Use a separate transaction scope to roll back the original operation.

单选题You are creating the DEPT_SAL data block from the PAYHIST form. Users should be able to enter a valid department ID number, which will then display the employee salary information for that department. This data block could potentially retrieve a large number of records. Since users will probably only view a small number of these records, only 10 records should be fetched at one time. How would you create the data block?()ASelect The Data Blocks node in the Object Navigator and click the Create button. Choose to build the data block manually, enter the procedure name in the Query Data Source Columns property, and the procedure code in the Query Data Source Arguments property. BChoose Tools - Data Block Wizard, select Table as the data source type, and base the block on the columns from the tables. CChoose Tools - Data Block Wizard, select, View as the data source type, and base the block on the columns from the tables. DSelect the Data Blocks node in the Object Navigator and click the Create button. Choose to build the data block manually, alter the Query Data Source Type property to 'FROM clause query', and enter the SELECT statement in the Query Data Source Name property. ESelect the Data Block node in the Object Navigator and click the Create button. Alter the Query Data Source Type, Query Data Source Name, Query Data Sources Columns, and Query Data Source Arguments properties to create a stored procedure that uses a red cursor.

单选题You work in a company which is named Wiikigo Corp. The company uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. There is a report which is often executed during business time. There is a stored procedure that is used as the data source for the report. You get a report from users saying that they receive the data returned by the report but the data is inconsistent. As the technical support, you check and find that phantom reads cause this problem. You must make sure that consistent data is returned by the report while not affecting other users. So what action should you perform to achieve this goal?()AYou should configure the database for Read Committed Snapshot isolation. BYou should modify the stored procedure to use the Snapshot isolation level CYou should configure the database for Auto Update Statistics asynchronously DYou should modify the stored procedure to use the Repeatable Read isolation level

多选题You need to ensure that the stored procedure that inserts new loan requests can access data in tables that are stored in another database on the same SQL Server instance. Which two actions should you perform?()AEnsure that the stored procedure and the tables are owned by users that are associated with the same SQL Server login.BEnsure that the stored procedure and the tables are owned by the same database user.CEnsure that the stored procedure and the tables use the same database schema.DConfigure the multiuser database option on both databases.EConfigure the cross-database ownership chaining option on both databases.

单选题You need to ensure that old data and current data can be queried according to the business requirements. What should you do?()ASpecify a view based on the archival data table and current data tables.BSpecify that the data must be queried by using a stored procedure.CSpecify that both the archival data table and the current data tables must have indexes created on the same columns.DSpecify that a SQL Server Agent job must be used to copy current data into the archival data table each night.

单选题You are creating the CUST_PREMIUM data block in the AUTO_INSURANCE form. A new state law requires that premiums be lowered for drivers with a good driving history. Because this could potentially affect a large number of records, you want to base the data block on a stored procedure returning a table of records. Which statement supports this approach?()AA table of records is efficient in terms of network traffic. BA table of records improves developer productivity because the database administrator does not have to create a server side view. CA table of records is efficient because the number of records fetched depends on the Array Fetch property value.DYour coding effort is simplified since DML operations are handles by setting form module properties.

单选题You are creating an online catalog application that will display product information on the company Web site. The product data is stored in a SQL Server 2005 database. The data is stored as relational data but must be passed to the application as an XML document by using FOR XML. You test your application and notice that not all of the items matching your query appear in the XML document. Only those products that have values for all elements in the schema appear.   You need to modify your Transact-SQL statement so that all products matching your query appear in the XML document. What should you do?()AAdd an XML index to the table that contains the product data.BAdd the XSINIL argument to the ELEMENTS directive in the query.CAdd a HAVING clause to the query.DAdd the replace value of clause to the query.

单选题Consider the Mysql Enterprise Audit plugin. A CSV file called data.csv has 100 rows of data. The stored procedure prepare_db ( ) has 10 auditable statements. You run the following statements in the mydb database: Mysql> CALL prepare_db ( ); Mysql> LOAD DATA INFILE '/tmp/data.cav' INTO TABLE mytable; Mysql> SHOW TABLES; How many events are added to the audit log as a result of the preceding statements?()A12; only top-level statements and stored procedure events are loggedB111; top-level statements and all lower-level statements are loggedC3; only the top-level statements are loggedD102; top-level statements are logged, but LOAD DATA INFILE is logged as a separate event

单选题You are creating the SAL_INFO data block on the EMP_QUERY form. The SALARY field should only be populated if the logged-on user is a manager. Since this query could potentially return a large amount of records, you have created a stored procedure which uses a ref cursor on which to base the data block. How would you create the data block?()AClick the Data Blocks node in the Object Navigator and click the create button. Choose to build the data block manually. Enter the procedure name in the Query Data Source Columns property and the procedure code in the Query Data Source Arguments property. BChoose Tools - Data Block Wizard, select Table as the data source type, and base the data block on the columns included in the procedure. CSelect the Data Blocks node in the Object Navigator and click the Create button. Choose to build the data block manually, alter the Query Data Source Type property to 'Ref cursor', and enter the name of the procedure in the Query Data Source Name property. DSelect the Data Blocks node in the Object Navigator and click the Create button. Alter the Query Data Source Name, Query Data Source Columns, and Query Data Source Arguments properties to create a stored procedure that uses a ref cursor. ELaunch the Data Block Wizard, select Stored Procedures as the data source type, and base the block on the procedure.

单选题The accounting manager wants you to create a form that when queried will display a calculated total of year-to-date actual expenditures for the found code entered. The values needed to generate this summary data are stored in multiple tables. Which data source type can you assign to the data block for this form without having the DBA create a database object?()Adatabase table Btransactional trigger Cstored procedure DFROM clause query Eclient-side procedure

单选题Your application must access data that is located on two SQL Server 2005 computers. One of these servers is named SQL1 and the other is SQL2. You have permissions to create a stored procedure on SQL1 to support your application. However,on SQL2 you only have permissions to select data. You write the stored procedure on SQL1. The stored procedure accesses SQL2 by using the OPENQUERY Transact-SQL statement. However,the query fails when executed.You need to troubleshoot the cause of the error. What should you do?()AJoin the two servers by using the four-part syntax of server.database.schema.table.BReference SQL2 by using an alias.CAdd SQL2 as a remote server to SQL1.DAdd SQL2 as a linked server to SQL1.

单选题You work in a company which uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. There is a stored procedure. The stored procedure implements a database maintenance process. A SQL Server Agent job should be created to that runs the stored procedure. Besides this, you must make sure that after it is completed successfully, the job is removed.  What should you do? ()AYou should create a job which is assigned to the Database Maintenance categoryBYou should create an Alert which will run another to delete the maintenance job.CYou should create a job. You schedule the job to run only once.DYou should create a job. The job uses the Automatically delete job option

单选题You work in a company which is named Wiikigo Corp. The company uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. According to the company requirement, the names of all user-defined stored procedures must contain the prefix usp_ on all instances. Besides this, you must make sure that stored procedures that do not contain this prefix cannot be created by you. What should you do?()AA policy should be created. The policy targets the name of the stored procedure that is evaluated on demand. BA policy should be created. The policy targets the name of the stored procedure that is evaluated on change. CA condition should be created. The condition targets the name of the stored procedure that is evaluated on change DA condition should be created. The condition targets the name of stored procedure that is evaluated on demand.

单选题You work in a company which uses SQL Server 2008. You are the administrator of the company database. Now you are in charge of a SQL Server 2008 instance. There are user-defined stored procedures. Now you have to make sure two things, first, the names of all user-defined stored procedures must contain the prefix usp_ on all instances; second, stored procedures that do not contain this prefix cannot be created by you.  So what should you do to ensure this two?()AYou should create a policy that targets the name of the stored procedure that is evaluated on change. BYou should create a policy that targets the name of the stored procedure that is evaluated on demand.CYou should create a condition that targets the name of stored procedure that is evaluated on demand. DYou should create a condition that targets the name of the stored procedure that isevaluated on change.