Show TOC

rs_datarow_for_writetextLocate this document in the navigation structure

Provides an image of the data row associated with a <text>, <unitext>, or <image> column updated with the Transact-SQL writetext command, with the Client-Library function ct_send_data, or with the DB-Library™ functions dbwritetext and dbmoretext.

Example 1

Executes a stored procedure named capture_datarow, setting the value of @<au_id >to the value of the <au_id> column and the value of @<copy> to the status value for the <copy> column.

create function string
 for sqlserver_derived_class
 output rpc
 'execute capture_datarow
   @au_id = ?au_id!new?,
   @copy = ?copy!text_status?'
  • Replication Server executes rs_datarow_for_writetext before updated< text>, <unitext>, or <image> data is sent to the replicate data server. rs_datarow_for_writetext provides the values of primary key columns and searchable columns from the row so that subscriptions can be processed and data can be transferred to the replicate database.

  • rs_datarow_for_writetext accesses the values of all columns in the row except for <text>, <unitext>, and <image> columns. To retrieve information about <text>, <unitext>, or <image> columns, include the <text_status> modifier in the function string. The values returned by <text_status> are described in the "text_status values for text, unitext, and image data" table..

  • The rs_datarow_for_writetext function has replication definition scope.

  • Replication Server generates an rs_datarow_for_writetext function string for <rs_sqlserver_function_class> and <rs_default_function_class> when you create a replication definition.

  • If you use a user-created base function-string class, you must create a rs_datarow_for_writetext function string for each replication definition that includes <text>, <unitext>, and <image> columns.

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

  • The default generated function string for <rs_sqlserver_function_class> and <rs_default_function_class> does not execute commands in the replicate database, since the row image contains no modified data.

  • You can create a new rs_datarow_for_writetext function string to collect the values of the primary key to pass to a gateway. The <old> and <new> modifiers both provide access to a column’s value.

  • The <text_status> modifier retrieves the status of the <text>, <unitext>, or <image> column. text_status values for text, unitext, and image data lists the possible values for the <text_status> modifier.

Table 1: text_status Values for text, unitext, and image Data




The column has a null text pointer. There are no modifications to <text>, <unitext>, or <image> columns.


Modifications were made at the primary database, which caused a text pointer allocation. Replication Server executes the rs_textptr_init function to allocate a text pointer.


The current data value follows. Replication Server executes the rs_writetext function to modify the <text>, <unitext,> or <image> data at the replicate database.


The <text>, <unitext>, or <image> column is not replicated. No commands are required in the replicate database because the data did not change value and the <text>, <unitext>, or <image> column has a replicate_if_changed status.


The <text>, <unitext>, or <image> column contains a null value after an operation at the primary database. For example, after a text pointer has been allocated, there may be data values in a <text> or <image> column and an application at the primary database sets them to null. Replication Server truncates the <text>, <unitext>, or <image> column in the replicate database by setting the values to null if the <text_status> is not 0x0008.