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.
Creates a new Microsoft.SqlServer.Replication.CreationScriptOptions enumeration object.
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
New-DbaReplCreationScriptOptions
[[-Options] <String[]>]
[-NoDefaults]
[<CommonParameters>]
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.
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.
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 |
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 |