A computed column is a virtual column that is not physically stored in the table, unless the column is marked PERSISTED. A computed column expression can use data from other columns to calculate a value for the column to which it belongs.
There are two types of computed columns namely persisted and non-persisted.
1. Non-persisted columns are calculated on the fly (ie when the SELECT query is executed) whereas persisted columns are calculated as soon as data is stored in the table.
2. Non-persisted columns do not consume any space as they are calculated only when you SELECT the column. Persisted columns consume space for the data
Example:
No comments:
Post a Comment