Computed columns allow you to create an expression and place the result of the expression in a table column. A computed column is:
Materialized – when its value is computed for each insert or update. A materialized computed column is stored in the same way as regular columns.
Virtual – when its value is computed only when referenced in a query. A virtual computed column is stored in the table or index page.
A computed column expression can be:
Deterministic – when its value is the same each time it is evaluated.
Nondeterministic – when its value may be different each time it is evaluated (for example, a date stamp).
See the Adaptive Server Enterprise System Administration Guide for more information about creating and managing computed columns.
Replication Server replicates materialized computed columns in DML statements in the same way it replicates other columns; it does not replicate virtual computed columns.
The replication of computed columns is supported by function strings. With Replication Server version 15.0 and later, the class-level function string rs_set_dml_on_computed is applied at the replicate database DSI when a connection is established. It issues set dml_on_computed “on” after the use database statement. If the replicate Adaptive Server is 12.5.x or earlier, the command is ignored.
When you are creating or altering replication definitions for tables containing:
Deterministic columns – you can choose whether or not to include those columns in the replication definition. Because deterministic columns always realize the same value, you can create the replication definition without them and allow each replicated insert and update to compute values at the replicate database.
Nondeterministic columns – you must include nondeterministic computed columns in the replication definition to ensure that the primary and replicate databases remain synchronized.