Skip to content

Instantly share code, notes, and snippets.

@alevyinroc
Created October 31, 2021 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alevyinroc/2a846b680280126b48f5ab00e0bba1a8 to your computer and use it in GitHub Desktop.
Save alevyinroc/2a846b680280126b48f5ab00e0bba1a8 to your computer and use it in GitHub Desktop.
process {
$SqlInstance = "MyServer";
$SourceDb = "MySourceDb";
$TargetDb = "MyTargetTb";
$TableList = @("Table1","Table2","Table3","Table4");
foreach ($Table in $TableList) {
Start-ThreadJob -ThrottleLimit 4 -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