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. Materialized computed columns are stored in the same way as regular columns.
Virtual – when its value is computed only when referenced in a query. Virtual computed columns are not stored in the table or index page.
A computed column expression is:
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).
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. In Replication Server version 15.0, 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 version 12.5.x or earlier, the command is ignored.
Since Replication Server does not distinguish between computed and regular columns, there are no changes to the syntax for creating or altering replication definitions.
When creating or altering replication definitions for tables containing:
Deterministic columns – you can choose whether to include those columns in the replication definition. Since 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.
rs_subcmp supports comparison and reconciliation of materialized computed columns; it does not support virtual columns.
If the supported Adaptive Server provides the set dml_on_computed “on” command, rs_subcmp inserts and updates deterministic and nondeterministic materialized columns as regular columns.