DECLARE @name varchar(100) DECLARE authors_cursor CURSOR FOR SELECT table_schema + '.' + table_name as [name] FROM information_schema.tables WHERE table_type = 'base table' OPEN authors_cursor FETCH NEXT FROM authors_cursor INTO @name WHILE @@FETCH_STATUS = 0 BEGIN DBCC DBREINDEX (@name, '', 90) FETCH NEXT FROM authors_cursor INTO @name END deallocate authors_cursor