2016-05-12 38 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