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)

usp_IndexCreationStatements

By Pedro Lopes MS,

(SQL 2005) Creates Index Creation statements based on info colected in system view sys.dm_db_missing_index_details, either with included columns or just In(Equality) columns.

EDIT: Statements are shown in results pane because of need to properly indent the output code.

EDIT2: Added check for redundant indexes, so dba can opt out of creating them.

EDIT3: Wrong drop statements fixed.

Total article views: 988 | Views in the last 30 days: 6
 
Related Articles
FORUM

Referencing indexes in a SQL statement

Referencing indexes in a SQL statement

SCRIPT

Scripting CREATE INDEX Statements Automatically From Your Tables

Stored proc for scripting out full CREATE INDEX statements from your table indexes with all filegrou...

FORUM

Indexing During an INSERT INTO Statement

Automatic indexing while appending

SCRIPT

Generate Create FK-indexes

Generate create statements for missing FK indexes, based on DRI

BLOG

SQL Server Disable Indexes and Rebuild Indexes dynamically

To generate the ALTER INDEX..DISABLE  and  the ALTER INDEX..REBUILD statements for all nonclustered ...

Tags
indexing    
sql server 2005    
 
Contribute