• Hugo Kornelis (12/14/2012) -

    The reason for this limitation? (Puts on speculative hat) Many settings are discouraged anyway, and I guess that MS decided not to put in extra engineering effort to support and test indexed views (and several other features with similar limitations) under all those settings. So they simply forbid them.

    Now I understand why speculation is considered a negative speech pattern.

    Hugo, If you take a look at the SQL documentation the reason is clear.

    Even if an expression is deterministic, if it contains float expressions, the exact result may depend on the processor architecture or version of microcode. To ensure data integrity, such expressions can participate only as non-key columns of indexed views. Deterministic expressions that do not contain float expressions are called precise. Only precise deterministic expressions can participate in key columns and in WHERE or GROUP BY clauses of indexed views.

    How would the database engine test the values of an indexed view for the right data percision when executing or running the TSQL from a client if that client connection has the SET option ARITHABORT turned ON?

    Apparently this has nothing to do with the testing practices of MS Engineers. 😛

    More likely it is the testing done by the Database Engine to data and columns that are to be included in the indexed view.

    In this specific example it is the testing of the data being inserted into a column that is participating in the indexed view.

    All of the above need to check the percision of the Data Types and that requires SET ARITHABORT OFF and several other OFF

    When creating and manipulating indexes on computed columns or indexed views, the SET options ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER, ANSI_NULLS, ANSI_PADDING, and ANSI_WARNINGS must be set to ON. The option NUMERIC_ROUNDABORT must be set to OFF.

    If any of these options are not set to the required values, INSERT, UPDATE, and DELETE actions on indexed views or tables with indexes on computed columns will fail. SQL Server will raise an error listing all the options that are incorrectly set. Also, SQL Server will process SELECT statements on these tables or indexed views as though the indexes on computed columns or on the views do not exist.

    http://msdn.microsoft.com/en-us/library/aa259205(v=sql.80).aspx

    Like my grandfather always said; "You are served better by knowing how to read than how to write." 😎