x
login about faq Site discussion (meta-askssc)

Is there a function or Stored procedure can be called if we use create & drop index user interface in MSSQL

Hi All,

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.

Thanks,

Hery

more ▼

asked Oct 09 '12 at 07:15 AM in Default

heryhe gravatar image

heryhe
30 3 5 7

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Oct 09 '12 at 07:31 AM

Kev Riley gravatar image

Kev Riley ♦♦
46.1k 39 43 69

Hi Riley, Thanks for your prompt reply. That's good idea, but is there an interactive tool that I can use to generate index from particular table and column?

Hery

Oct 09 '12 at 08:19 AM heryhe
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x44

asked: Oct 09 '12 at 07:15 AM

Seen: 138 times

Last Updated: Oct 09 '12 at 08:20 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.