dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Copy-DbaTableData fails with more than 1 -Table provided

Open Adam-Wenger opened this issue 8 years ago • 0 comments

Bug Report

General Troubleshooting steps

Tested with 0.9.315, 0.9.318, 0.9.319

  • [X] Verified running the latest release of dbatools?
  • [X] Verified errors are not related to permissions?
  • [X] Can duplicate in new/clean PowerShell session (clean = powershell -NoProfile)?

Version Information

  • Operating System (Windows 10):
  • PowerShell Version: 5.1
  • SQL Server (Enterprise | 13.0.4474.0):

Issue

When I supply 2 tables to the -Table parameter, I get an error that the DataReader is already open. This occurs when I use 2 different shapes available in the Examples in the .ps1 file.

Steps to Reproduce

Copy-DbaTableData -SqlInstance 'usServer,1234' -Database 'TemporaryDB' -Destination 'usServer,1234' -DestinationDatabase 'MyDestinationDatabase' -Table 'ww.Comment', 'ww.Entity' -KeepIdentity -KeepNulls -BatchSize 5000 -Truncate

The following option from the Example section also fails for the same reason:

Get-DbaTable -SqlInstance 'usServer,1234' -Database TemporaryDB -Table ww.Comment, testing.Competitor | Copy-DbaTableData -Destination 'usServer,1234' -DestinationDatabase 'MyDestinationDatabase' -KeepIdentity -KeepNulls -BatchSize 5000 -Truncate

image

Problem to solve

Allow for an array of tables to copy be used in -Table

Adam-Wenger avatar Apr 03 '18 19:04 Adam-Wenger