Posts from Anders and webrunner point to how this script uses a new feature in SSMS not available in SQL 2000 QM. The
syntax to run something multiple times is not available in QM.
This raises a red flag about testing. The script works fine in SSMS against a SQL 2000 database. This implies that even in a SQL2005 db, it may not work from a program or in a stored procedure.
I've already burned a half-hour on this and have too much to do today, so will leave the resolution of that question to others.