2016-05-12 36 views
0

爲什麼不能在具有PERSISTED NOT NULL計算列的聚簇索引上設置FILLFACTOR無法在SQL Server中的聚簇索引上指定FILLFACTOR(ANSI_PADDING錯誤)

查詢設置FILLFACTOR

ALTER INDEX [PK_MyIndex] ON [MyTable] REBUILD PARTITION=ALL WITH (FILLFACTOR = 90) 

錯誤:

ALTER INDEX failed because the following SET options have incorrect settings: 'ANSI_PADDING'. 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. 

是否有可能得到這個工作?

回答

2

請閱讀下面的文章: https://msdn.microsoft.com/en-AU/library/ms187403.aspx

SET ANSI_PADDING must be ON when you are creating or changing indexes on computed columns or indexed views. For more information about required SET option settings with indexed views and indexes on computed columns, see "Considerations When You Use the SET Statements" in SET Statements (Transact-SQL).

試試下面的語句:

SET ANSI_PADDING ON 
ALTER INDEX [PK_MyIndex] ON [MyTable] REBUILD PARTITION=ALL WITH (FILLFACTOR = 90) 
+0

謝謝!我在腦海中想到必須將ANSI_PADDING設置爲表格。 –

+0

不客氣! – Alex