Show TOC

rs_selectLocate this document in the navigation structure

Selects rows for subscription materialization from the primary copy of a replicated table and, for subscription dematerialization, from the replicate copy of the table.

Examples
Example 1

Creates an instance of an rs_select function string. Replication Server uses this function string when a subscription where clause specifies a specific value for the <au_lname> column.

create function string
   authors.rs_select;name_select
 for flat_file_class
 scan 'select * from authors
   where au_lname = ?l_name!user?'
 output rpc
 'execute name_sel ?l_name!user?, "authors"'
Usage
  • Replication Server executes rs_select to retrieve subscription materialization rows from the primary Replication Server when without holdlock is included in the create subscription command. without holdlock is used in non-atomic materialization. The function string used for this operation is in the class assigned to the primary database.

  • To retrieve data during atomic materialization, use the function-string class and error class associated with the primary database connection, not the classes associated with the replicate database connection.

  • Replication Server also executes rs_select to identify rows for subscription dematerialization, if you drop a subscription for a table replication definition using incrementally with purge. The function string used for this operation is in the class assigned to the replicate database.

  • If create subscription does not include without holdlock, Replication Server executes the rs_select_with_lock function instead of rs_select.

  • rs_select has replication definition scope.

  • Replication Server generates rs_select function strings for the system-provided function-string classes when you create a replication definition.

  • If you use a user-created base function-string class, create rs_select function strings for each replication definition to match each possible subscription where clause.

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

  • The default generated function strings for rs_select, for the <rs_sqlserver_function_class> and <rs_default_function_class> classes for each replication definition, use the Transact-SQL select command syntax.

  • Function strings for rs_select have input and output templates. The input template is a SQL select command with a where clause that Replication Server matches with the where clause in the create subscription command.

  • If Replication Server cannot match the where clause in a select operation to a function string input template, it uses a function string with no input template, if one exists.

  • An rs_select function call fails if Replication Server cannot locate a function string with a matching input template or a function string with no input template.