I am have been using this procedure to reorganize the indexes in all my tables for a database:
EXEC sp_MSforeachtable @command1="print 'Reorganizing indexes for ?' ALTER INDEX ALL ON ? REORGANIZE"
GO
I ran into this issue where there was an error performing this operation:
Reorganizing indexes on every table in the database.
Reorganizing indexes for [dbo].[ASPStateTempApplications]
Reorganizing indexes for [dbo].[tposCompanySettings]
Reorganizing indexes for [dbo].[tpaUnits]
Reorganizing indexes for [dbo].[tpsCrewRecurrence]
Reorganizing indexes for [dbo].[tplIssueTypes]
Reorganizing indexes for [dbo].[tpwLocationGroups]
Msg 1943, Level 16, State 1, Line 1
The index "IDX_tpwLocationGroups_CID" on table "tpwLocationGroups" cannot be reorganized because page level locking is disabled.
Does anyone know how I can modify the script (or a different one) to skip over indexes that cannot do this operation and continue to the next table?
Thanks