Sets or displays the replication status for text and image columns.
sp_setrepcol table_name [, {column_name | null} [, {do_not_replicate | always_replicate | replicate_if_changed}]]
The name of the replicated table. You must enable replication for the table using sp_setreptable before you execute sp_setrepcol.
The name of a text or image column in the table. Specify null for the column name to set the replication status of all text and image columns in the table.
Prevents Adaptive Server from logging replication information for the text and image column.
Causes Adaptive Server to log replication information for the text and image column when any column in the row changes. This status adds overhead for replicating text and image columns that do not change; however, it protects against data inconsistency from row migration or changes during non-atomic materialization.
Causes Adaptive Server to log replication information for the text and image column only when the text and image column data changes. This status reduces overhead, but it may lead to data inconsistency from row migration or changes during non-atomic materialization.
Displays the replication status for all text and image columns in the au_pix table. au_pix must be marked for replication using sp_setreptable.
sp_setrepcol au_pix
Displays the replication status for the pic column in the au_pix table. pic must be a text or image datatype column.
sp_setrepcol au_pix, pic
Specifies that the pic column (image datatype) in the au_pix table should have the replicate_if_changed status. (In this particular table in the pubs2 database, there are no other text or image columns.)
sp_setrepcol au_pix, pic, replicate_if_changed
Specifies that all text and image columns in the au_pix table should have the replicate_if_changed status.
sp_setrepcol au_pix, null, replicate_if_changed
Use sp_setrepcol to specify how text and image columns are replicated after you have enabled replication for the table with sp_setreptable.
You can also execute sp_setrepcol with a table name to display the replication status of all of the text and image columns in the table, or with the table name and a text or image column name to display the replication status of the specified column.
Using the replicate_if_changed option reduces the overhead of replicating text and image columns. However, the following restrictions and cautions apply:
If you specify the replicate_if_changed status for a column, any replication definition that includes the column must also have the replicate_if_changed status.
If you set the replication status of any column to replicate_if_changed, you cannot set autocorrection to “on” for any replication definition that includes the column.
If you use non-atomic subscription materialization and you have set the replicate_if_changed replication status for any text or image columns, Replication Server displays a message in the error log file. This message warns you that the data may be inconsistent if an application modified the primary table during subscription materialization.
If your application allows rows to migrate into a subscription and you have set the replicate_if_changed replication status for any text or image column, Replication Server displays a warning message in the error log when the row migrates into the subscription and the text or image data is missing.
If a text or image column with the replicate_if_changed status was not changed in an update operation at the primary table and the update causes the row to migrate into a subscription, the inserted row at the replicate table will be missing the text or image data. Run the rs_subcmp program to reconcile the data in the replicate and primary tables.
Row migration can occur when subscriptions have where clauses. Updating a column specified in the subscription where clause can cause a row to become valid for, or migrate into, the subscription.
When this happens, Replication Server must execute an insert in the replicate database. An insert requires values for all of the columns, including text and image columns that did not change in the primary database.
When tables are marked with sp_reptostandby, you cannot change the replication status of text and image columns using sp_setrepcol; text and image columns are always treated as replicate_if_changed.
If the warm standby application includes normal replication and you have marked tables with sp_reptostandby and sp_setreptable, text and image data columns may be treated as always_replicate or replicate_if_changed.
If text and image columns marked by sp_setreptable are specified always_replicate (the default), all text and image columns are treated as always_replicate.
If text and image columns are specified by sp_setrepcol as do_not_replicate or replicate_if_changed, all text and image columns are treated as replicate_if_changed.
sp_setrepcol requires sa or dbo permission or replication_role.