Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Generate Create All Secondary Indexes For Entire Database

By Gary Fry,

Run this script on the database you want to generate the create index script on. I have included configuration variables for all of the index options.

@OnlineIfPossible

Setting this to 1 will generate online index statements if it is
supported for the edition you are using and if the datatype allows
it.
@MoveToFileGroup

This will allow you to specify a file group to store the secondary
indexes. If the index is clustered it will use the original file group.
Set this value to null to use the original file group

@DropCreate

Setting this to 1 will set the drop and recreate the index if it
exists.

@FillFactorOverride

Setting this value will set the fill factor to the value you select.
Setting this value to null will use the original fill factor

Total article views: 2562 | Views in the last 30 days: 21
 
Related Articles
FORUM

REBUILD THE INDEXES BY FILE GROUP

HELP NEEDED=REBUILD THE INDEXES BY FILE GROUP

FORUM

Data Grouping

Data Grouping

BLOG

Automating the Processing of a Measure Groups Index Using SSIS

In a recent post (Processing a Measure Groups Index Using SSMS), I showed you how to utilize SQL S...

FORUM

Missing Index DMVs not sync

no result when JOINing sys.dm_db_missing_index_group_stats = sys.dm_db_missing_index_groups

FORUM

clustered index

clustered index

Tags
indexing    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones