Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Copy-DbaDbTableData output & bugfix #4787

Merged
merged 1 commit into from
Dec 8, 2018

Conversation

Adam-Wenger
Copy link
Contributor

Adding (Source and Destination) Schema to the output; helpful in cases where you have >1 schema with the same named table.
Also fixed -AutoCreateTable -> It was not properly replacing the schema name for the new table if it differed from the source schema. It was retaining the original source schema due to bug in regex

Type of Change

Purpose

Fixes AutoCreateTable when the Source schema differs from the desired destination schema. the current code just used the source due to typo in the regex.

Second change is to add SourceSchema and DestinationSchema to the pscustomobject output of the function so that you can clearly see what schema the tables are in

Approach

Added the values to the output.

Commands to test

$copyArgs = @{

   SqlInstance = $devInstance;
   Database = "Sandbox";
   Table = 'ref.YourTable';
   Destination = $devInstance;
   DestinationDatabase = "Sandbox";
   DestinationTable = 'new.NewName';
   AutoCreateTable = $true;
   KeepIdentity = $true;
   KeepNulls = $true;
   Truncate = $true;
   Verbose = $true;
}

Copy-DbaDbTableData @copyArgs;

Screenshots

image

Adding (Source and Destination) Schema to the output; helpful in cases where you have >1 schema with the same named table.
Also fixed -AutoCreateTable -> It was not properly replacing the schema name for the new table if it differed from the source table.
@potatoqualitee potatoqualitee merged commit 97f9b30 into development Dec 8, 2018
@potatoqualitee
Copy link
Member

excellent, thank you adam!

@potatoqualitee potatoqualitee deleted the Copy-DbaDbTableData-4786 branch December 8, 2018 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants