Sunday, August 30, 2009

MCTS 70-433 Computed Columns in Tables

A computed column is computed from an expression that can use other columns in the same table. I've not seen them in uses often but the concept is fairly straight forward.

More interesting questions are, can you index on a computed column? There are also consideration for computed column referencing a CLR function:

By marking a computed column as PERSISTED, you can create an index on a computed column that is deterministic but not precise. Additionally, if a computed column references a CLR function, the Database Engine cannot verify whether the function is truly deterministic. In this case, the computed column must be PERSISTED so that indexes can be created on it. For more information, see Creating Indexes on Computed Columns.

http://msdn.microsoft.com/en-us/library/ms191250.aspx

No comments: