rs_writetext

Modifies text, unitext, or image data in a replicate database.

Examples

Usage

  • rs_writetext has replication definition scope.

  • For each replicated text, unitext, or image column in a replication definition, Replication Server generates an rs_writetext function string for the rs_sqlserver_function_class and rs_default_function_class classes when you create the replication definition.

  • If you use a user-created function-string class, create an rs_writetext function string for each replicated text, unitext, or image column included in the replication definition.

  • Create or customize an rs_writetext function string at the Replication Server where you created the replication definition.

  • Replication Server supports three output formats for creating an rs_writetext function string: RPC, writetext, and none.

Using the RPC Method

With the RPC method for creating an rs_writetext function string, Replication Server executes a remote procedure call repeatedly, providing up to 255 bytes of the text, unitext, or image value on each procedure execution.

The data is passed in the RPC in a varchar parameter for text or unitext data or in a varbinary parameter for image data. Replication Server ensures that the data chunks are partitioned on character boundaries for text or unitext columns. If a 1-byte character set is in use, the data is sent in 255-byte chunks.

Each time Replication Server executes the RPC, it sets the rs_last_text_chunk system variable, an int, to 0 if there is more data to follow or to 1 if this is the last RPC execution for this text column.
  • Another int system variable, rs_writetext_log, is set to 1 if the writetext logging option was used in the primary database or 0 if the logging option was not used in the primary database.

  • The values of other columns in the data row can be accessed by using the new or old modifier. If you used the Transact-SQL insert command at the primary database, you must use the new modifier.

  • Use the text_status modifier to retrieve the status of a text, unitext, or image column. For a description of the text_status modifier, see "rs_datarow_for_writetext."

Using the writetext Method

The writetext method for creating an rs_writetext function string provides the options shown in the following table to specify the logging behavior in the replicate database.

writetext Logging Options

Logging Option

Description

use primary log

Log the data in the replicate database transaction log if the logging option was specified in the primary database transaction log. Do not log if logging is not specified in the primary database transaction log.

with log

Log the data in the replicate database transaction log.

no log

Do not log the data in the replicate database transaction log.

The default function string for rs_sqlserver_function_class uses the use primary log option.

Using the none Method

The none output template option for rs_writetext function strings instructs Replication Server not to use the Client-Library function ct_send_data to update a text, unitext, or image column value. This option provides necessary flexibility for using text, unitext, or image columns in a heterogeneous environment.

See the Replication Server Administration Guide Volume 2 for more information.

Related reference
rs_get_textptr
rs_textptr_init
rs_datarow_for_writetext