Show TOC

rs_usedbLocate this document in the navigation structure

Changes the database context in a data server.

Example 1

Changes an existing rs_usedb function string to one that is similar to the default function string generated by Replication Server for the system-provided function-string classes.

alter function string rs_usedb
 for sqlserver_derived_class
 output language
 'use ?rs_destination_db!sys_raw?'
Example 2

Creates an rs_usedb function string with an empty string for an output template for a data server that does not support multiple databases.

create function string rs_usedb
 output language ''
  • The Replication Server DSI executes the function when it first connects to the data server.

  • rs_usedb has function-string class scope.

  • Replication Server creates an initial rs_usedb function string for the system-provided function-string classes during installation.

  • If you use a user-created base function-string class, create a function string for the rs_usedb function.

  • Create or customize an rs_usedb function string at the Replication Server that is the primary site for the class.

  • The default generated function string for the rs_usedb function, for the <rs_sqlserver_function_class> and <rs_default_function_class> classes, has the syntax of the Transact-SQL use command.

  • If a data server does not support multiple databases or a database context, the output template can be an empty string (' ').