Link to home
Start Free TrialLog in
Avatar of pvsadm
pvsadm

asked on

Dropping ALL indexes (incl PK) on a table

is there a way to drop all indexes (PK + indexes) on a table? is there a stored procedures? i don't know the names of the indexes... i want to use it in my program to clear a table of the indexes and rebuild new indexes...
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

In summary:

*) capture current info using EXEC sp_helpindex 'tablename'
*) drop non-clustered indexes
*) drop clustered index (if any)
*) recreate non-clustered indexes
*) recreate clustered index (if any)



ASKER CERTIFIED SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial