Which Transact-SQL batch should you use?

You administer a Microsoft SQL Server 2012 databasethat contains a table named OrderDetail. You discover
that the NCI_OrderDetail_CustomerID non-clustered index is fragmented. You need to reduce fragmentation.
You need to achieve this goal without taking the index offline. Which Transact-SQL batch should you use?

You administer a Microsoft SQL Server 2012 databasethat contains a table named OrderDetail. You discover
that the NCI_OrderDetail_CustomerID non-clustered index is fragmented. You need to reduce fragmentation.
You need to achieve this goal without taking the index offline. Which Transact-SQL batch should you use?

A.
CREATE INDEX NCI_OrderDetail_CustomerID ON OrderDetail.CustomerID WITH DROP
EXISTING

B.
ALTER INDEX NCI_OrderDetail_CustomerID ON OrderDetail.CustomerID REORGANIZE

C.
ALTER INDEX ALL ON OrderDetail REBUILD

D.
ALTER INDEX NCI_OrderDetail_CustomerID ON OrderDetail.CustomerID REBUILD

Explanation:
Reference: http://msdn.microsoft.com/en-us/library/ms188388.aspx



Leave a Reply 3

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


Akbar Ali

Akbar Ali

I think the answer provided here is wrong as the index pointing to Table and Column name. which gives error message when you execute it.

The answer should be

ALTER INDEX NCI_OrderDetail_CustomerID ON OrderDetail REORGANIZE

Kevin

Kevin

i tried it,akbar Ali is right,
the index pointing to table and column name is wrong,SqlServer will raise error about this:

Msg 1088, Level 16, State 9, Line 3
Cannot find the object “table.column” because it does not exist or you do not have permissions.