Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a quick way to reindex ?

Status
Not open for further replies.

babeo

Technical User
Mar 30, 2000
398
CA
Hi

I have a table having a field indexed with non-clustered, now I want to reindex the field as unique and clustered. Should I just drop the index first and recreate it or what is the best way to reindex it without dropping at the 1st place?.

There are a few tables related to this table through this index field (may be I am not talking properly: index or constrainst, but they related through this field), and I don't know any impact if I am dropping this index and causes any problem?

Please post a full command too.

Thanks.
 
No problem - other tables, constraints etc will still be valid when you drop your index.
Just do :
drop index myindex
go
CREATE UNIQUE CLUSTERED INDEX myindex
ON mydbowner.mytable(mycol1...)
go

HTH
;-) Dickie Bird
db@dickiebird.freeserve.co.uk
 
Just FYI, you can rebuild an index and then drop the existing one (as long as that wouldn't result in having two clustered indexes on the same table and you keep the indexes' names unique).

BOL,

JMC J M Craig
Alpha-G Consulting, LLC
nsjmcraig@netscape.net
 
Thanks all.
That's secured me enough.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top