Hi Dirk,
which version of SQL Server are you using ?
This script[/url] uses the DMV sys.dm_db_index_physical_stats usable only by the 2005 version of SQL Server.
To defragment indexes with SQL Server 2000 you can use this script (for the moment in Italian language, also released a brief translation in English).
Thanks.
Sergio