Current case that I have now, is creating hundreds of indexes in five databases. I already have the name of tables, columns and indexes. What I don't want here to do is create the indexes one by one manually. Is there a function or stored procedure can be called to generate create and drop index script?
Your help will be very appreciated.
asked Oct 09, 2012 at 07:15 AM in Default
No, but you can write one.
Put the data about tables, columns and indexes into a table and then use a query over that to generate the create index sql statements - copy and paste the output into another query window and run! Alternatively execute the statement as dynamic sql from within the proc, but I would prefer to see the output first, just to give a sanity check.
answered Oct 09, 2012 at 07:31 AM
Kev Riley ♦♦