Dropping function strings

To discard a customized function string in a derived class and restore the function string from the parent class, drop the function string. Use the drop function string command to remove one or more function strings in a function-string class.

WARNING! If you want to drop and re-create a function string, use alter function string to replace an existing function string with a new one. Dropping and then re-creating a function string by other methods can lead to a state where the function string is temporarily missing. If a transaction that uses this function string occurs between the time the function string is dropped and the time it is re-created, Replication Server detects the function string as missing and fails the transaction.

When you drop the function string from a derived class, you restore the function string from the parent class.

Refer to Chapter 3, “Replication Server Commands,” in the Replication Server Reference Manual for more information on drop function string command.

You can also drop customized function strings from the system-provided class rs_sqlserver_function_class.

To restore a default function string for a function string with replication-definition scope that you have dropped, use the alter function string command to omit the output clause. See “Restoring default function strings” for details.

Examples

The following command drops the rs_insert function string for the publishers_rep replication definition in the class sqlserver2_func_class:

drop function string
publishers_rep.rs_insert
for sqlserver2_func_class

The following command drops the pub_id instance of a function string for the rs_select function for the publishers_rep replication definition in the class derived_class. Drop function strings for the rs_select_with_lock function in a similar way.

drop function string
publishers_rep.rs_select;pub_id
for derived_class

The following command drops the rs_begin function string from the gateway_func_class function-string class:

drop function string rs_begin
for gateway_func_class

Dropping all function strings for a function

In cases where there are multiple function strings for a specified function, you can drop all function strings for that function simultaneously.

The following command drops all function strings for the rs_select_with_lock function that references the publishers_rep replication definition in the class sqlserver2_func_class:

drop function string
publishers_rep.rs_select_with_lock;all
for sqlserver2_func_class

System functions that can have multiple function string mappings include the rs_select, rs_select_with_lock, rs_get_textptr, rs_textptr_init, or rs_writetext functions.

Examples of using the all keyword as shorthand

When dropping function strings for any system function for which you provided a lengthy name, you can use the all keyword as shorthand for the name of the function string instance. For example, the following command gives a long name for a function string:

create function string
publishers_rep.rs_insert;my_insert_function_string
for sqlserver2_func_class
 ...

In this case, the following command drops the function string without you having to enter the fully qualified name:

drop function string
publishers_rep.rs_insert;all
for sqlserver2_func_class