Show TOC

rs_select_with_lockLocate this document in the navigation structure

Selects rows for subscription materialization from the primary copy of a replicated table, using a holdlock to maintain serial consistency.

Examples
Example 1

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

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

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

  • If the without holdlock clause is included in create subscription, Replication Server executes the rs_select function instead of rs_select_with_lock.

  • rs_select_with_lock has replication definition scope.

  • Replication Server generates rs_select_with_lock 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 an rs_select_with_lock function string for each replication definition to match each possible subscription where clause.

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

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

  • Function strings for rs_select_with_lock 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_with_lock function call fails if Replication Server cannot locate a function string with a matching input template or a function string with no input template.