Zdarzenia
31 mar, 23 - 2 kwi, 23
Największe wydarzenie szkoleniowe sql, sieci szkieletowej i usługi Power BI. 31 marca – 2 kwietnia. Użyj kodu FABINSIDER, aby zaoszczędzić $400.
Zarejestruj się już dziśTa przeglądarka nie jest już obsługiwana.
Przejdź na przeglądarkę Microsoft Edge, aby korzystać z najnowszych funkcji, aktualizacji zabezpieczeń i pomocy technicznej.
Applies to:
SQL Server
Azure SQL Managed Instance
This topic describes how to specify schema options in SQL Server by using SQL Server Management Studio or Transact-SQL. When you are publishing a table or view, you can control the object creation options that are replicated for the published object. You can set these option when the article is created, and you can also change them at a later time. If you do not explicitly specify these options for an article, a default set of options will be defined.
Uwaga
The default schema options when using replication stored procedures may differ from the default options when articles are added using SQL Server Management Studio.
In This Topic
Before you begin:
To specify schema options, using:
@schema_option
parameter of sp_addarticle (Transact-SQL) and sp_addmergearticle (Transact-SQL).Specify schema options, such as whether to copy constraints and triggers to Subscribers, on the Properties tab of the Article Properties - <Article> dialog box. This tab is available in the New Publication Wizard and the Publication Properties - <Publication> dialog box. For more information about using the wizard and accessing the dialog box, see Create a Publication and View and Modify Publication Properties.
On the Articles Page of the New Publication Wizard or Publication Properties - <Publication> dialog box, select an article, and then click Article Properties.
Select which articles schema option changes should apply to:
Click Set Properties of Highlighted <ObjectType> Article to launch the Article Properties - <ObjectName> dialog box; property changes made in this dialog box are applied only to the object that is highlighted in the object pane on the Articles page.
Click Set Properties of All <ObjectType> Articles to launch the Properties for All <ObjectType> Articles dialog box; property changes made in this dialog box are applied to all objects of that type in the object pane on the Articles page, including ones not yet selected for publication.
Uwaga
Property changes made in the Properties for All <ObjectType> Articles dialog box override any made previously in the Article Properties - <ObjectName> dialog box. If, for example, you want to set a number of defaults for all articles of an object type, but also want to set some properties for individual objects, set the defaults for all articles first. Then set the properties for the individual objects.
In the Copy Objects and Settings to Subscriber and Destination Object sections of the Properties tab of the Article Properties - <Article> dialog box, specify values for the options.
Modify any properties if necessary, and then click OK.
If you are in the Publication Properties - <Publication> dialog box, click OK to save and close the dialog box.
Schema options are specified as a hexadecimal value that is the | (Bitwise OR) result of one or more options. For more information, see sp_addarticle and sp_addmergearticle.
Uwaga
You must convert schema option values from binary to int before performing a bitwise operation. For more information, see CAST and CONVERT (Transact-SQL).
@publication
, a name for the article for @article
, the database object being published for @source_object
, the type of database object for @type
, and the | (Bitwise OR) result of one or more schema options for @schema_option
. For more information, see Define an Article.@publication
, a name for the article for @article
, the database object being published for @source_object
, and the | (Bitwise OR) result of one or more schema options for @schema_option
. For more information, see Define an Article.At the Publisher on the publication database, execute sp_helparticle. Specify the name of the publication to which the article belongs for @publication
and the name of the article for @article
. Note the value of the schema_option
column in the result set.
Execute a & (Bitwise AND) operation using the value from step 1 and the desired schema option value to determine if the option is set.
If the result is 0, the option is not set.
If the result is the option value, the option is already set.
If the option is not set, execute a | (Bitwise OR) operation using the value from step 1 and the desired schema option value.
At the Publisher on the publication database, execute sp_changearticle. Specify the name of the publication to which the article belongs for @publication
, the name of the article for @article
, a value of schema_option
for @property
, and the hexadecimal result from step 3 for @value
.
Run the Snapshot Agent to generate a new snapshot. For more information, see Create and Apply the Initial Snapshot.
At the Publisher on the publication database, execute sp_helpmergearticle. Specify the name of the publication to which the article belongs for @publication
and the name of the article for @article
. Note the value of the schema_option column in the result set.
Execute a & (Bitwise AND) operation using the value from step 1 and the desired schema option value to determine if the option is set.
If the result is 0, the option is not set.
If the result is the option value, the option is already set.
If the option is not set, execute a | (Bitwise OR) operation using the value from step 1 and the desired schema option value.
At the Publisher on the publication database, execute sp_changemergearticle. Specify the name of the publication to which the article belongs for @publication
, the name of the article for @article
, a value of schema_option
for @property
, and the hexadecimal result from step 3 for @value
.
Run the Snapshot Agent to generate a new snapshot. For more information, see Create and Apply the Initial Snapshot.
Zdarzenia
31 mar, 23 - 2 kwi, 23
Największe wydarzenie szkoleniowe sql, sieci szkieletowej i usługi Power BI. 31 marca – 2 kwietnia. Użyj kodu FABINSIDER, aby zaoszczędzić $400.
Zarejestruj się już dziśSzkolenie
Moduł
Ocena strategii migracji do usługi Azure SQL - Training
Ocena strategii migracji do usługi Azure SQL
Dokumentacja
View and Modify Article Properties - SQL Server
View and Modify Article Properties
Replicate Schema Changes - SQL Server
Learn how to replicate schema changes in SQL Server by using SQL Server Management Studio or Transact-SQL.
Specify how changes are propagated (Transactional) - SQL Server
Learn how to specify how change are propagated for a Transactional Publication in SQL Server.