Udostępnij za pośrednictwem


sp_register_custom_scripting (języka Transact-SQL)

Replikacja umożliwia zdefiniowanej przez użytkownika niestandardowym procedur przechowywanych zamienić jeden lub więcej procedur domyślnych używanych w replikacji transakcyjnej.When a schema change is made to a replicated table, these stored procedures are re-created.sp_register_custom_scripting registers a stored procedure or Transact-SQL script file that is executed when a schema change occurs to script out the definition for a new user-defined custom stored procedure.This new user-defined custom stored procedure should reflect the new schema for the table.sp_register_custom_scripting is executed at the Publisher on the publication database, and the registered script file or stored procedure is executed at the Subscriber when a schema change occurs.

Topic link iconKonwencje składni języka Transact-SQL

sp_register_custom_scripting [ @type  = ] 'type'
    [ @value = ] 'value' 
    [ , [ @publication = ] 'publication' ]
    [ , [ @article = ] 'article' ]

Argumenty

  • [ @ type = ] "type'
    Is the type of custom stored procedure or script being registered.type is varchar(16), with no default, and can be one of the following values.

    Wartość

    Description

    Wstawianie

    Zarejestrowanych niestandardowa procedura przechowywana jest wykonywany podczas replikacji instrukcja INSERT.

    Aktualizacja

    Zarejestrowanych niestandardowa procedura przechowywana jest wykonywane po instrukcja UPDATE jest replikowana.

    Usuwanie

    Zarejestrowanych niestandardowa procedura przechowywana jest wykonywane po instrukcja DELETE są replikowane.

    custom_script

    Skrypt jest wykonywany na końcu wyzwalacza danych definicji języka (DDL).

  • [ wartość @= ] "value'
    Name of a stored procedure or name and fully-qualified path to the Transact-SQL script file that is being registered.value is nvarchar(1024), with no default.

    Uwaga

    Specifying NULL for valueparameter will unregister a previously registered script, which is the same as running sp_unregister_custom_scripting.

    Gdy wartość type jest custom_scriptnazwisko i Pełna ścieżka Transact-SQL Oczekiwano pliku skryptu. W przeciwnym razie value musi być nazwą zarejestrowanych procedura przechowywana.

  • [ @ publikacja= ] "publication'
    Name of the publication for which the custom stored procedure or script is being registered.publication is sysname, with a default of NULL.

  • [ @ artykuł = ] "article'
    Name of the article for which the custom stored procedure or script is being registered.article is sysname, with a default of NULL.

Wartości kodów powrotnych

0 (sukces) lub 1 (brak)

Remarks

sp_register_custom_scripting jest używany w migawka i replikacja transakcyjnej.

Tę procedura przechowywana powinny być wykonywane przed do tworzenia schematu zmiany zreplikowanej tabela.Aby uzyskać więcej informacji na temat korzystania z tej procedura przechowywana zobacz Ponowne generowanie niestandardowych transakcyjne procedury odbicie zmiany schematu.

Uprawnienia

Tylko członkowie sysadmin stała rola serwera db_owner stałe rola bazy danych lub db_ddladmin stała rola bazy danych może być wykonywany sp_register_custom_scripting.