microsoft / microsoft/sqlmanagementobjects
Error While Transfering System Versioned Temporal Tables
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 143
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
While doing a direct database Transfer using the SMO.Transfer Object, I get this error at the System Versioned Temporal Tables:
Unhandled exception. Microsoft.SqlServer.Management.Common.TransferException: An error occurred while transferring data. See the inner exception for details.
---> System.InvalidOperationException: The given ColumnMapping does not match up with any column in the
source or destination.
at Microsoft.Data.SqlClient.SqlBulkCopy.AnalyzeTargetAndCreateUpdateBulkCommand(BulkCopySimpleResultSet internalResults)
at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource1 source)
at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource1 source)
at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)
at Microsoft.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)
at Microsoft.Data.SqlClient.SqlBulkCopy.WriteToServer(DbDataReader reader)
at Microsoft.SqlServer.Management.Smo.Transfer.SqlBulkCopyData(SqlConnection sourceConnection, SqlConnection destinationConnection, TransferWriter writer, SqlTransaction transaction)
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Smo.Transfer.TransferData()
I am hoping that there is a flag that I need to turn on or that because I turned off a setting this has happened. Here is my current setup for my Transfer object:
`var transfer = new Transfer(sourceDB);
transfer.CopyAllObjects = false;
transfer.CopyData = true;
transfer.CopyAllTables = false;
transfer.CopyAllViews = false;
transfer.CopyAllStoredProcedures = false;
transfer.CopyAllUserDefinedFunctions = false;
transfer.PrefetchObjects = true;
transfer.Options.WithDependencies = true;
transfer.Options.ContinueScriptingOnError = true;
transfer.Options.IncludeIfNotExists = true;
transfer.Options.AllowSystemObjects = false;
transfer.Options.Indexes = true;
transfer.Options.ClusteredIndexes = true;
transfer.Options.NonClusteredIndexes = true;
transfer.Options.DriAll = true;
transfer.Options.ChangeTracking = true;
transfer.Options.EnforceScriptingOptions = false;
transfer.Options.Bindings = true;
transfer.Options.IncludeHeaders = true;
transfer.Options.ClusteredIndexes = true;
transfer.Options.ExtendedProperties = true;
transfer.Options.AllowSystemObjects = true;
transfer.Options.Permissions = false;
transfer.DestinationDatabase = destinationDBName;
transfer.DestinationServer = destinationSQLInstanceName;
transfer.DestinationPassword = destinationSQLPassword;
transfer.DestinationLogin = destinationSQLUser;
transfer.DestinationLoginSecure = false;
`
With a custom list of tables and Views.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported SMO.Transfer configuration and reproduce the failure using a system-versioned temporal table and the custom table/view selection. Compare the source and destination column mappings reported by SqlBulkCopy; done means the transfer completes without the ColumnMapping exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100