Created
October 31, 2021 16:59
-
-
Save alevyinroc/fb0dc5d2c1ba27eb4c9a8971f9934e4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| begin { | |
| $SqlInstance = Connect-DbaInstance -SqlInstance "MyServer"; | |
| } | |
| process { | |
| $SqlInstance = "MyServer"; | |
| $SourceDb = "MySourceDb"; | |
| $TargetDb = "MyTargetTb"; | |
| $TableList = @("Table1","Table2","Table3","Table4"); | |
| foreach ($Table in $TableList) { | |
| Start-ThreadJob -ThrottleLimit 2 -ArgumentList $SqlInstance, $SourceDb, $TargetDb, $Table -ScriptBlock { | |
| param($SqlInstance, | |
| $Source | |
| $Destination | |
| $TableName) | |
| Copy-DbaDbTableData -SqlInstance $SqlInstance -Database $Source -Destination $Destination -Table $TableName; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment