I would like a stored procedure that will take as input the name of a table.
Whatthe procedure would do is drop all indexes on that table excpet any index that ends with U1 or P1, and save the information on the ones it drops.
Then I would like another strored procedure that takes a table name as input and puts back all the indexes that were dropped.
We need to load 1 to 3 million rows a night and we manually drop all the indexes and put them back after the load. Is this something that can be written as a stored procedure?

While this can be done, it is more efficient and much safer to hard code the list of indexes which need to be dropped into a stored procedure, and the same with the create index commands. It requires a little more maintenance when ever indexes are added to the tables, but the end result will be much better.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

Processing your response...

Discuss This Question: 2 &nbspReplies

There was an error processing your information. Please try again later.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

I don't even know where the SQL Text is stored for each index so I can retrieve it before actually deleting teh index. When I go into SQL Enterprise and Manage Indexes, I can view thetext, but I have no idea where and how it is stored.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

Processing your reply...

Ask a Question

Free Guide: Managing storage for virtual environments

Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!

To follow this tag...

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy