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)

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: 983 | Views in the last 30 days: 5
 
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

BLOG

SQL Server Disable Indexes and Rebuild Indexes dynamically

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

SCRIPT

Generate Create FK-indexes

Generate create statements for missing FK indexes, based on DRI

Tags
indexing    
sql server 2005    
 
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