SQL Clone
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)

Script all indexes as CREATE INDEX statements

By Lowell Izaguirre,

this script will generate CREATE index statements for all indexes in the database;
there are already scripts out there that script constraints for primary keys and unique constraints, which automatically create an index behind the scenes. but what about the other indexes?
uncomment two statements in order to filter out primary keys and Unique indexes so you can get all the other types,

Total article views: 17992 | Views in the last 30 days: 16
Related Articles

Index Utilization Summary Report Script

Index Report Scripts ...


script included index

index include script


Script all Indexes

Generate scripts for all indexes in a database


INDEX NAME, TAble Name, Index Script required.

INDEX NAME, TAble Name, Index Script.


Generate Index only scripts for whole DB

scripts indexes database