• SQL* (1/23/2013)


    Hi All,

    While reading about Computed column if found that if we mentioned PERSISTED Key word while creating/altering table then we can create index. But i'm able to create index with out that key word also.

    By marking a computed column as PERSISTED, you can create an index on a computed column that is deterministic but not precise.

    There's no need to make the column persisted prior to indexing it.

    I'm assuming you're referring to the text here. It reads like it's been copied out of context from somewhere else and the real meaning has been lost as a result.

    I suspect it's really referring to computed columns that are deterministic, but imprecise (usually based on CLR functions), but I can see why you're confused.

    This documentation has a more complete explanation of the imprecise computed column requirements :

    http://msdn.microsoft.com/en-us/library/ms189292.aspx#BKMK_persisted

    You can create an index on a computed column that is defined with a deterministic, but imprecise, expression if the column is marked PERSISTED in the CREATE TABLE or ALTER TABLE statement. This means that the Database Engine stores the computed values in the table, and updates them when any other columns on which the computed column depends are updated. The Database Engine uses these persisted values when it creates an index on the column, and when the index is referenced in a query. This option enables you to create an index on a computed column when Database Engine cannot prove with accuracy whether a function that returns computed column expressions, particularly a CLR function that is created in the .NET Framework, is both deterministic and precise.