Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 3060 | Views in the last 30 days: 9
 
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