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)
Thank this author by sharing:
Download in .rgtool format for use with
SQL Scripts Manager, a free tool that provides simple GUIs for SQL scripts.
By Tommy Bollhofer,
Previous Version (http://www.sqlservercentral.com/scripts/SQL+Server+2005/61278/)
Iterates through sys.tables; performs an online index rebuild on indexes where the logical fragmentation is greater than or equal to the @LogicalFragmentationPercent parameter. The procedure can perform offline rebuild on indexes containing text, ntext, image, xml, varchar(max), varbinary(max) and nvarchar(max) or an offline rebuild by partition. This procedure is intended to reside in the msdb database and will conditionally create and populate a table called dbo.index_maintenance_history, configured via the @MaintainHistory parameter. This procedure can also produce and HTML report via the @EmailNotification paramter.
To utilize this with RedGate's SQL Script Manager, please save T-SQL above as usp_DBA_index_maintenance_SSC.sql along with the *.rgtool code, preferably in the C:\ProgramData\Red Gate\SQL Scripts Manager directory.
In the past several readers have posted problems w/ downloading the T-SQL from the WYSWYG editor. Should you encounter any of these types of issues, I've made the scripts available via my SkyDrive.
Rebuild Index Script by srihari nandamuri
This rebuild index script does not rebuild indexes when the script is run from the master database.
Rebuilding indexes for better performance.