Which Transact-SQL statement should you run?

You are the database administrator of your company. The network contains five instances of SQL Server 2008.
An instance named SQL1 contains a database named Salesdb that is used by users in the sales department.
Some users report that when they query the Salesdb database, they receive out-of-range values from severaltables.
You want to identify out-of-range values for columns in all the tables in the Salesdb database.
Which Transact-SQL statement should you run?

You are the database administrator of your company. The network contains five instances of SQL Server 2008.
An instance named SQL1 contains a database named Salesdb that is used by users in the sales department.
Some users report that when they query the Salesdb database, they receive out-of-range values from severaltables.
You want to identify out-of-range values for columns in all the tables in the Salesdb database.
Which Transact-SQL statement should you run?

A.
the DBCC CHECKDB statement with the DATA_PURITY clause

B.
the DBCC CHECKDB statement with the EXTENDED_LOGICAL_CHECKS clause

C.
the DBCC CHECKTABLE statement with the DATA_PURITY clause

D.
the DBCC CHECKTABLE statement with the EXTENDED_LOGICAL_CHECKS clause

Explanation:

You should run the DBCC CHECKDB statement with the DATA_PURITY clause. The DBCC CHECKDB statement allows you to verify the allocation and structural integrity of all the objects in the database specified inthe statement. When you specify the DATA_PURITY clause in the DBCC CHECKDB statement, it identifies allinvalid or out-of-range values for columns in all the tables in the database. You should not run the DBCC CHECKDB statement with the EXTENDED_LOGICAL_CHECKS clause. The EXTENDED_LOGICAL_CHECKS clause verifies the logical consistency of indexed views, XML indexes, andspatial indexes when the compatibility level is SQL Server 2008 or higher. The EXTENDED_LOGICAL_CHECKS clause cannot be used to identify invalid values for columns in the database. You should not run the DBCC CHECKTABLE
statement with the DATA_PURITY clause. In this scenario, youwant to identify invalid values in all the tables in the Salesdb database. This can be achieved by using the
DBCCCHECKDB statement. The DBCC CHECKTABLE statement is used for a particular table in the database, not alltables in the database. You should not run the DBCC CHECKTABLE statement with the EXTENDED_LOGICAL_CHECKS clause. The EXTENDED_LOGICAL_CHECKS clause verifies the logical consistency of indexed views, XML indexes, andspatial indexes when the compatibility level is SQL Server 2008 or higher. In addition, the DBCC CHECKTABLE statement will only check a table within a database, not the entire database.

Objective:
Maintaining a SQL Server Database

Sub-Objective:
Maintain database integrity.

References:
TechNet > TechNet Library > Server Products and Technologies > SQL Server > SQL Server 2008 > ProductDocumentation > SQL Server 2008 Books Online > Database Engine > Technical Reference > Transact-SQLReference > DBCC (Transact-SQL) > DBCC CHECKDB (Transact-SQL)



Leave a Reply 0

Your email address will not be published. Required fields are marked *