Link to home
Start Free TrialLog in
Avatar of jdrits
jdrits

asked on

Drop and Recreate all indexes

Greetings, Sybase experts!

We have about 320 indexes or so in a particular database that we need to drop and recreate to clear up some space and to make them "clean" again.

We use Embarcadero's RapidSQL, and what we normally would do is to execute the code that drops and creates each index. But with 320 or so of these, it takes some time. What I'd like to be able to do is to create a stored proc that has the code to drop and recreate all 320 indexes, so we don't have to execute each one by one.

We need to repeat this every couple months or so, so having the code all in one place will be helpful going forward.

Isn't the code stored in a table somewhere? Couldn't I do a select that will dump the index drop and creation code for each index in the database and spool the results, which I could then copy and paste in a new stored proc?

If so, what would the query be? If not, is there any way to do this other than manually copying each code and pasting it into a text file?

Thanks,

John
ASKER CERTIFIED SOLUTION
Avatar of Joe Woodhouse
Joe Woodhouse

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
Avatar of jdrits
jdrits

ASKER

Thanks, Joe! We actually found a way with the RapidSQL tool to do it, but you've given us some other useful information as well.

Many thanks!

John
Good on you for figuring it out anyway. Glad I could add something useful!