Managing indexes in SQL Server 2005 has changed. All the index management functions are now located in a new and more standardized, ALTER INDEX statement. The DBCC DBREINDEX, DBCC INDEXDEFRAG and DBCC SHOWCONTIG commands are now deprecated and will be removed in future versions.
a) To rebuild an index on a table, we now use the REBUILD keyword like this:
ALTER INDEX PK_CustomerID ON Customers
REBUILD
b) To rebuild all indexes on a table, we can use the ALL keyword like this:
ALTER INDEX ALL ON Customers
REBUILD
c) To handle index fragmentation, use the REORGANIZE keyword like this:
ALTER INDEX IX_CustomerName ON Customers
REORGANIZE
d) To disable an index, use the DISABLE keyword like this:
ALTER INDEX IX_CustomerName ON Customers
DISABLLE
Note: To re-enable the index, use the REBUILD keyword as shown earlier.
e) To view size and fragmentation information, use the sys.dm_db_index_physical_stats catalog view instead. Example:
SELECT * FROM sys.dm_db_index_physical_stats
Home »Unlabelled » SQL2005: Alter.Index
Popular Post
-
There needs to be a book called Carpooling for dummies written by art car central that helps people drive and park in around swimmin...
-
If you were 3 years old, what car do you want your parents to own? It's not an easy question to ask a 3 year old as there answers are l...
-
V12 / 5.576 cc / 385 PS / 406 ft/lb (550 Nm) @ 4.000 / 0 - 62 mph (100 km/h): 6,6 s / Vmax: 155 mph (250 km/h) (click images for a larger ...
-
Aston Martin has today confirmed the company's intention to revive the historic British Lagonda marque. In a statement announcing the n...
-
go full screen on the below video found on http://www.jalopyjournal.com/?p=16967 famed auto designer Daniel Simon to pen up a concept and ...
-
This car sent in by Jake Stichler This is a 92 F150, currently residing in Lebanon, PA with nearly a quarter million miles that I picked up ...
-
Talks in Brussels between troubled banking group RBS and the EU have raised the prospect that the group's major motoring brands Direct L...
-
The Bubble Truck is a modified 2001 Dodge Ram 1500 extended cab pickup truck "sculptured" with a variety of ornaments and other d...
-
From what I recall from reading the superb book 'The Fast Set' about the British land speed record racers in the 1920's and 1930...
-
Here's our undercover agent "Codename JannieJumbo" cycling about maintaining his legend as an 'activist' within the so...
No comments:
Post a Comment