Retrieving a column using the %GETCOL function without reading the same row from the table

An example of how to retrieve a column, without reading the same row from the table.

This example refers to the primary and secondary tables. The table names referenced in the examples follow the format for the CDC Replication Engine for Microsoft SQL Server and CDC Replication Engine for Sybase databases. If you installed another CDC Replication replication engine, see the table_name parameter in this function for more information about specifying table names which depends on your database.

To use the example, you must add a derived column to the MASTER.DBO.EMPLOYEE primary table and enter the specified %GETCOL function in that column.

%GETCOL(NAMES, MASTER.DBO.STATE, , STATES, STATE)

This function call retrieves the NAMES column from the MASTER.DBO.STATE secondary table, using the key column STATE in the primary table and the key column STATES in the secondary table. If a record in the primary table has a state that does not exist in MASTER.DBO.STATE, then this function returns the default value for the data type of the NAMES column. For example, blank characters if the data type is character.

%GETCOL(COUNTRYS, MASTER.DBO.STATE, )

Used after the previous %GETCOL function, this function call retrieves the COUNTRYS column from the MASTER.DBO.STATE secondary table, without reading again the same row from the table. If a record in the primary table has a state that does not exist in MASTER.DBO.STATE, then this function returns the default value for the data type of the COUNTRYS column. For example, blank characters if the data type is character.