Replies: 1 comment
-
Updated to 2.0.3 but all the same |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I use dbatools (1.1.145) Copy-DbaDbTableData to copy data between tables of identical databases (production and test).
Copy-DbaDbTableData -SqlInstance $server -Database $SourceDatabase -SqlCredential $dest_credential -Destination $DestinationServer -DestinationDatabase $DestinationDatabase -Table $TableToProcess -NoTableLock -BulkCopyTimeout 0 -BatchSize 500000 -EnableException
The table structures are the same, but in some tables, the order of fields in the source table may not correspond to the order of fields in the [test database] destination table (all fields exist, they have the same names/types, but different column_id if you look at sys.columns for the corresponding table).
If such a situation occurs and the field types are different, an error occurs when calling Copy-DbaDbTableData.
But there are cases when the order of fields is different, but the type is compatible (int and tinyint, for example) - in such cases, the data is successfully copied, but not to the correct fields :(
Is it possible to use ColumnMap to specify field mappings when copying data using Copy-DbaDbTableData, and if so, how can it be done?
P.S. ChatGPT suggested that I use the -ColumnMappings parameter of Copy-DbaDbTableData, but it seems that this parameter is not valid. There is no information about this parameter in the documentation, and when I tried to use it, I received an error message: "A parameter cannot be found that matches parameter name 'ColumnMappings'".
Beta Was this translation helpful? Give feedback.
All reactions