Show TOC

rs_updateLocate this document in the navigation structure

Updates a single row in a table in a replicate database.

Examples
Example 1

Replaces the existing rs_update function string for the <authors> table with one that is similar to the default function string generated by Replication Server for the system-provided function-string classes.

alter function string authors.rs_update
 for sqlserver_derived_class
 output language
 'update authors set au_id = ?au_id!new?,
     au_lname = ?au_lname!new?,
     au_fname = ?au_fname!new?,
     phone = ?phone!new?,
     address = ?address!new?,
     city = ?city!new?,
     state = ?state!new?,
     country = ?country!new?,
     postalcode = ?postalcode!new?
   where au_id = ?au_id!old?'
Usage
  • Replication Server executes rs_update to update a single row in a table. The row is identified by the primary key columns defined in a replication definition for the table.

  • The rs_update function has replication definition scope.

  • Replication Server generates an rs_update function string for the system-provided function-string classes when you create the replication definition.

  • If you use a user-created base function-string class, create an rs_update function string for each replication definition.

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

  • The default generated function string for rs_update, for the <rs_sqlserver_function_class> and <rs_default_function_class> classes for each replication definition, uses the Transact-SQL update command syntax. It replaces all columns in the row, and identifies the row with a where clause that specifies the pre-update values, or before image, of the primary key columns.

  • When set autocorrection is on, Replication Server does not use rs_update. Instead, it calls rs_delete to remove the existing row and rs_insert to insert the row.

  • Replication Server cannot send <text>, <unitext>, or <image> data with rs_update, but it can report the status of <text>, <unitext>, or <image> data with the <text_status> modifier. For a description of the <text_status> modifier, see rs_datarow_for_writetext. Data of type <text>, <unitext>, or <image> is sent to the replicate database with the rs_get_textptr, rs_textptr_init, rs_datarow_for_writetext, and rs_writetext functions.