Author | Jess Pomfret (@jpomfret), jesspomfret.com |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Add-DbaReplArticle on GitHub.
Want to see the Bill Of Health for this command? Check out Add-DbaReplArticle.
Add an article configuration to a publication in a database on the SQL Server instance(s).
Add an article configuration to a publication in a database on the SQL Server instance(s).
Add-DbaReplArticle
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[-Database] <String>
[-Publication] <String>
[[-Schema] <String>]
[-Name] <String>
[[-Filter] <String>]
[[-CreationScriptOptions] <PSObject>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Add-DbaReplArticle -SqlInstance mssql1 -Database Northwind -Publication PubFromPosh -Name TableToRepl
Adds the TableToRepl table to the PubFromPosh publication from mssql1.Northwind
PS C:\> $article = @{
SqlInstance = "mssql1"
Database = "pubs"
Publication = "testPub"
Name = "publishers"
Filter = "city = 'seattle'"
}
PS C:\> Add-DbaReplArticle @article -EnableException
Adds the publishers table to the TestPub publication from mssql1.Pubs with a horizontal filter of only rows where city = 'seattle.
PS C:\> $cso = New-DbaReplCreationScriptOptions -Options NonClusteredIndexes, Statistics
PS C:\> $article = @{
SqlInstance = 'mssql1'<br>
Database = 'pubs'<br>
Publication = 'testPub'<br>
Name = 'stores'<br>
CreationScriptOptions = $cso<br>
}<br>
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.
The SQL Server instance(s) for the publication.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
The publication database to apply the article configuration to be replicated.
Alias | |
Required | True |
Pipeline | false |
Default Value |
The name of the publication.
Alias | |
Required | True |
Pipeline | false |
Default Value |
The name of the object to add as an article.
Alias | |
Required | True |
Pipeline | false |
Default Value |
Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).
Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported.
For MFA support, please use Connect-DbaInstance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Schema where the article to be added is found.
Default is dbo.
Alias | |
Required | False |
Pipeline | false |
Default Value | dbo |
Sets the where clause used to filter the article horizontally, e.g., DiscontinuedDate IS NULL
E.g. City = 'Seattle'
Alias | |
Required | False |
Pipeline | false |
Default Value |
Options for the creation script.
Use New-DbaReplCreationScriptOptions to create this object.
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |