research Question

how to apply the same index to all user database except some

Avatar of marrowyung
marrowyung asked on
DatabasesSQLMicrosoft SQL ServerScripting Languages
35 Comments5 Solutions36 ViewsLast Modified:

I am going to apply the indexes, like:

CREATE NONCLUSTERED INDEX IX_cases_bActive_state_barcode
ON [dbo].[cases] ([bActive],[state])
INCLUDE ([barcode])

Open in new window

so all user database on a SQL instance, any script for it so that I can save a lot of time to apply the index (es) to nearly all user database (except some I don't want)?

the script must have a list let me exclude some user database I don't want to apply for it.

we will have more than 1x indexes I'd like to deploy.

please share a script you usually use on that.

Pavel Celba
All in One

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 5 Answers and 35 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 5 Answers and 35 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros