I have written this logic using sp_msforeachdb.
I need to ask Why have you used this condition
p.page_count >= 10
Is this to check if the Index is large enough to Rebuild or reorganize or any other reason?
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sometimes, winning is not an issue but trying.
You can check my BLOG [font="Arial Black"]
here[/font][/url][/right]