One problem with the script is that it is hard coded to use db_id 70 when using this:
sys.dm_db_index_physical_stats (70, NULL, NULL, NULL, NULL) AS p
Maybe change that to Default, null or 0 instead of 70
Sue
Oh thanks for pointing that out Sue. Not sure if I can change it now.