Little known fact, telling fabulous stories about bow ties is not my day job. Actually, my full time job is a SQL DBA (Database Administrator) It's hard work but someone has to reindex those fragmented tables. If you are ever in the need for a quick script to find fragmented indexes across all databases take a look at this handy script, from our good friend over at www.SQLAuthority.com. Pinal Dave exhibits a whole plethora of information about SQL Server, and heck we probably should have just named this bodacious bow tie after Mr. Dave, but I digress.
ps.index_id, b.name,ps.avg_fragmentation_in_percentFROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) ASpsINNER JOIN sys.indexes AS b ON ps.OBJECT_ID = b.OBJECT_IDAND ps.index_id = b.index_idWHERE ps.database_id = DB_ID()ORDER BY ps.OBJECT_ID