テーブルのインデックスを再構築しようとすると:
ALTER INDEX ALL ON [dbo].[Allocations] REBUILD
それはうまくいきます。
でも電話したら
EXECUTE sp_msForEachTable 'ALTER INDEX ALL ON ? REBUILD'
同じテーブルに到達すると、次のように失敗します。
メッセージ 1934、レベル 16、状態 1、行 2
次の SET オプションの設定が正しくないため、ALTER INDEX は失敗しました: 'QUOTED_IDENTIFIER'。計算列のインデックス付きビューやインデックス、フィルター選択されたインデックス、クエリ通知、XML データ型メソッド、空間インデックス操作で使用する SET オプションが正しいことを確認します。
そして、それが同じテーブルであることを確認するには:
EXECUTE sp_msForEachTable 'print ''Rebuilding ?'';
ALTER INDEX ALL ON ? REBUILD;
PRINT '' Done ?'''
結果は次のとおりです。
Rebuilding [dbo].[SystemConfiguration]
Done [dbo].[SystemConfiguration]
Rebuilding [dbo].[UserGroups]
Done [dbo].[UserGroups]
Rebuilding [dbo].[Groups]
Done [dbo].[Groups]
Rebuilding [dbo].[UserPermissions]
Done [dbo].[UserPermissions]
Rebuilding [dbo].[AllocationAdmins]
Done [dbo].[AllocationAdmins]
Rebuilding [dbo].[Allocations]
Msg 1934, Level 16, State 1, Line 2
ALTER INDEX failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.
私は何を間違っていないのですか?
注:
EXECUTE sp_msForEachTable 'DBCC DBREINDEX(''?'')'
正常に動作します!