Xpode.com        Click here to Print this article.

Create an index with Drop existing index on table

If you want to Create an cluster index on table then there should not be any index on that table. So first need to remove the old index and update the index. To do this we may write the below command to update the index by dropping the old one and creating the new.

CREATE
UNIQUE CLUSTERED INDEX i_IndexA 
ON
tbCompany(id) 
WITH 
(DROP_EXISTING = ON); 

- i_IndexA = name of the Index
- id= column name of the table
- Drop existing=on means that If any old index is existing on the table then it should be removed.



http://
http://

Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=298

Click here to go on website