Indexes Scripts SQL Server

How to create Drop and Recreate Script of all Indexes in a database?

IC152817

It’s a general requirement in the DBA job to scripts out the database objects and deployment the scripts in the new environment. Microsoft SQL Server provides us an option to script out the object using “Generate scripts” option. However sometimes we need more details about the current structure of the objects and we may want to change some parameters into the same. Below is one of the best script I got which provides almost all the information about the Index and also scripts out the indexes as well.

This script  (index_script_out_script.sql) generates the ‘create’ & ‘drop’ statement for index present in a database. You have to run this script on the required database and it will populate the information in the corresponding columns as below in the ‘Index_Create_Statement’ or ‘Index_Drop_Statement’.

1

 

Parvinder Pal

About Author

SQL Server DBA, Trainer, Blogger, Author

Leave a comment

You may also like

Installations & Configuration SQL Server Troubleshooting

SQL Server Database mail common issue

Problem: SQL Server Database Mail common issue We always use SQL Server Database mail feature to create email notification for
Installations & Configuration SQL Server Technology Virtualisation

How to use Microsoft Virtual Labs for Practical implementation

One of the important questions often asked by my fellow mates is how we can implement practical scenarios without configuring