commands

^

New-DbaReplCreationScriptOptions

Author Jess Pomfret (@jpomfret), jesspomfret.com
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out New-DbaReplCreationScriptOptions on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaReplCreationScriptOptions.

Synopsis

Creates a new Microsoft.SqlServer.Replication.CreationScriptOptions enumeration object.

Description

Creates a new Microsoft.SqlServer.Replication.CreationScriptOptions enumeration object that allows you to specify article options.

See https://learn.microsoft.com/en-us/dotnet/api/microsoft.sqlserver.replication.creationscriptoptions for more information

Syntax

New-DbaReplCreationScriptOptions
    [[-Options] <String[]>]
    [-NoDefaults]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> $cso = New-DbaReplCreationScriptOptions -Options NonClusteredIndexes, Statistics
PS C:\> $article = @{
>> SqlInstance           = 'mssql1'
>> Database              = 'pubs'
>> PublicationName       = 'testPub'
>> Name                  = 'stores'
>> CreationScriptOptions = $cso
>> }
PS C:\> Add-DbaReplArticle @article -EnableException

Adds the stores table to the testPub publication from mssql1.pubs with the NonClusteredIndexes and Statistics options set
includes default options.

Example: 2
PS C:\> $cso = New-DbaReplCreationScriptOptions -Options ClusteredIndexes, Identity -NoDefaults
PS C:\> $article = @{
>> SqlInstance           = 'mssql1'
>> Database              = 'pubs'
>> PublicationName       = 'testPub'
>> Name                  = 'stores'
>> CreationScriptOptions = $cso
>> }
PS C:\> Add-DbaReplArticle @article -EnableException

Adds the stores table to the testPub publication from mssql1.pubs with the ClusteredIndexes and Identity options set, excludes default options.

Optional Parameters

-Options

The options to set on published articles.
See https://docs.microsoft.com/en-us/dotnet/api/microsoft.sqlserver.replication.creationscriptoptions for a list of available options

Alias
Required False
Pipeline false
Default Value
-NoDefaults

If specified, no default options will be set on the object
Defaults are copied from when you add an article in SQL Server Management Studio and include:
PrimaryObject, CustomProcedures, Identity, KeepTimestamp,
ClusteredIndexes, DriPrimaryKey, Collation, DriUniqueKeys,
MarkReplicatedCheckConstraintsAsNotForReplication,
MarkReplicatedForeignKeyConstraintsAsNotForReplication, and Schema

Alias
Required False
Pipeline false
Default Value False