Script Download: IndexFragmentation.zip
http://gallery.technet.microsoft.com/scriptcenter/Check-SQL-Server-a-a5758043
This T-SQL sample script illustrates how to check index fragmentation of a specified database in SQL Server.
This script can be used for checking index fragmentation percentage of tables in SQL Server user databases. You can specify the database name and fragmentation percent, after you run the script, you will get the result.
You can find more All-In-One Script Framework script samples at http://aka.ms/onescriptingallery