Jeff Moden (2/16/2014)
I believe that a part of your problem is that you've hardcoded the database ID in your code at the following line.
from sys.dm_db_index_physical_stats ([font="Arial Black"]5[/font], null,null,null,'Limited') S
Yeah, that would be a huge contributor too:w00t:
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events