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’.