Script All Indexes SQL Server 2005/2008

I needed a script to script out all the indexes with their included columns. All the scripts I could find on the inernet only scripted the normal columns, so I created my own script to script all columns and included columns.

At the moment this script does not support Fill Factor, Filters, With Options or File Groups.

If and when I make any changes I will update this script. If you like you can make changes and send them to me and I’ll update accordingly

ALTER PROC ScriptOutIndexes


 OBJECT_NAME([ixs].[object_id]) 'table_name'
 ,[ixs].[type] 'index_type'
 ,[ixs].[name] 'index_name'
 ,[col].[name] 'column_name'

Read More »