Skip to main content

I got this error log. I try to find column in my customization but i see only one

System.Data.SqlClient.SqlException (0x80131904): Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once.
 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
 at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
 at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
 at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
 at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.executeDbCommand(IDbCommand cmd, Double& secondsSpent)
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.Execute(Func`1 cmdProvider)
ClientConnectionId:bec424fe-9566-4fb0-8c9e-3bbb93d2cec5
Error Number:2705,State:4,Class:16
PX.DbServices.Scripting.ScriptExecutionException: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once. ---> System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once.
 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
 at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
 at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
 at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
 at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.executeDbCommand(IDbCommand cmd, Double& secondsSpent)
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.Execute(Func`1 cmdProvider)
   --- End of inner exception stack trace ---
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.Execute(Func`1 cmdProvider)
 at PX.DbServices.Points.DbmsBase.PointDbmsBase.executeCommands(IEnumerable`1 commands, ExecutionContext context, Boolean withoutUsingDb)
 at PX.BulkInsert.Provider.TransferTriggers.CreateColumnsTrigger.WillTransformHeader(List`1 headerFromZip)
 at PX.BulkInsert.Provider.TransferTableTask.Executor..MoveNext()
 at PX.DbServices.Model.DataSet.PxDataRows..MoveNext()
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
System.Exception: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once. Table name: Address. File name: . Line number: 0. ---> PX.DbServices.Scripting.ScriptExecutionException: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once. ---> System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once.
 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
 at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
 at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
 at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
 at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.executeDbCommand(IDbCommand cmd, Double& secondsSpent)
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.Execute(Func`1 cmdProvider)
   --- End of inner exception stack trace ---
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.Execute(Func`1 cmdProvider)
 at PX.DbServices.Points.DbmsBase.PointDbmsBase.executeCommands(IEnumerable`1 commands, ExecutionContext context, Boolean withoutUsingDb)
 at PX.BulkInsert.Provider.TransferTriggers.CreateColumnsTrigger.WillTransformHeader(List`1 headerFromZip)
 at PX.BulkInsert.Provider.TransferTableTask.Executor..MoveNext()
 at PX.DbServices.Model.DataSet.PxDataRows..MoveNext()
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
   --- End of inner exception stack trace ---
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
 at PX.DbServices.Points.DbmsBase.DbmsTableAdapter.WriteRows(IEnumerable`1 rows, Boolean exclusiveWrite, Action`1 transferObserver)
 at PX.BulkInsert.Provider.TransferTableTask.Executor.Start(DataTransferObserver observer)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.RunSingleTask(TransferTableTask task)
PX.Data.PXException: An error occurred while importing data into the 'Address' table. ---> System.Exception: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once. Table name: Address. File name: . Line number: 0. ---> PX.DbServices.Scripting.ScriptExecutionException: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once. ---> System.Data.SqlClient.SqlException: Column names in each table must be unique. Column name 'UsrAccountName' in table 'dbo.Address' is specified more than once.
 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
 at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
 at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
 at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
 at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.executeDbCommand(IDbCommand cmd, Double& secondsSpent)
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.Execute(Func`1 cmdProvider)
   --- End of inner exception stack trace ---
 at PX.DbServices.Points.DbmsBase.DefaultExecutor`1.Execute(Func`1 cmdProvider)
 at PX.DbServices.Points.DbmsBase.PointDbmsBase.executeCommands(IEnumerable`1 commands, ExecutionContext context, Boolean withoutUsingDb)
 at PX.BulkInsert.Provider.TransferTriggers.CreateColumnsTrigger.WillTransformHeader(List`1 headerFromZip)
 at PX.BulkInsert.Provider.TransferTableTask.Executor..MoveNext()
 at PX.DbServices.Model.DataSet.PxDataRows..MoveNext()
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
   --- End of inner exception stack trace ---
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
 at PX.DbServices.Points.DbmsBase.DbmsTableAdapter.WriteRows(IEnumerable`1 rows, Boolean exclusiveWrite, Action`1 transferObserver)
 at PX.BulkInsert.Provider.TransferTableTask.Executor.Start(DataTransferObserver observer)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.RunSingleTask(TransferTableTask task)
   --- End of inner exception stack trace ---
 at PX.Data.Update.DtObserver.AskHowToRecoverFromError(Exception ex)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.RunSingleTask(TransferTableTask task)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.fetchAndRunNextTask()
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.StartSync()
 at PX.Data.Update.DtObserver.AskHowToRecoverFromError(Exception ex)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.StartSync()
 at PX.Data.Update.PXSnapshotUploader.UploadSnapshot(ZipArchiveWrapper zip, Point point, FileFormat readFormats, FileFormat writeFormats)
 at PX.Data.Update.PXSnapshotUploader.<>c__DisplayClass6_0.<Start>b__0()
 at PX.Data.Update.DatabaseLock.DatabaseOperation(PXDatabaseProvider provider, Action act, Boolean lockDB, Boolean disableFullText)
 at PX.Data.Update.PXSnapshotUploader.Start()
 at PX.Concurrency.CancellationIgnorantExtensions.RunWithCancellationViaThreadAbort(Action method, CancellationToken cancellationToken)
 at PX.Concurrency.CancellationIgnorantExtensions.<>c__DisplayClass1_0.<ToCancellationViaThreadAbort>b__0(CancellationToken cancellationToken)
 at PX.Concurrency.Internal.PXLongOperationPars.PopAndRunDelegate(CancellationToken cancellationToken)
 at PX.Concurrency.Internal.RuntimeLongOperationManager.PerformOperation(PXLongOperationPars p)

Have you got the package published on the tenant you are trying to import the package before you are doing the import. If you have i would unpublish it first


I unpublished but still happen error.

this is log

System.InvalidOperationException: String or binary data would be truncated.
 at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
System.InvalidOperationException: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. ---> System.InvalidOperationException: String or binary data would be truncated.
 at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
   --- End of inner exception stack trace ---
 at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
 at System.Data.SqlClient.SqlBulkCopy.ReadWriteColumnValueAsync(Int32 col)
 at System.Data.SqlClient.SqlBulkCopy.CopyColumnsAsync(Int32 col, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyRowsAsync(Int32 rowsSoFar, Int32 totalRows, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)
 at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table, DataRowState rowState)
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
System.Exception: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. Table name: Address. File name: . Line number: 0. ---> System.InvalidOperationException: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. ---> System.InvalidOperationException: String or binary data would be truncated.
 at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
   --- End of inner exception stack trace ---
 at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
 at System.Data.SqlClient.SqlBulkCopy.ReadWriteColumnValueAsync(Int32 col)
 at System.Data.SqlClient.SqlBulkCopy.CopyColumnsAsync(Int32 col, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyRowsAsync(Int32 rowsSoFar, Int32 totalRows, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)
 at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table, DataRowState rowState)
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
   --- End of inner exception stack trace ---
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
 at PX.DbServices.Points.DbmsBase.DbmsTableAdapter.WriteRows(IEnumerable`1 rows, Boolean exclusiveWrite, Action`1 transferObserver)
 at PX.BulkInsert.Provider.TransferTableTask.Executor.Start(DataTransferObserver observer)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.RunSingleTask(TransferTableTask task)
PX.Data.PXException: An error occurred while importing data into the 'Address' table. ---> System.Exception: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. Table name: Address. File name: . Line number: 0. ---> System.InvalidOperationException: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. ---> System.InvalidOperationException: String or binary data would be truncated.
 at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
   --- End of inner exception stack trace ---
 at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
 at System.Data.SqlClient.SqlBulkCopy.ReadWriteColumnValueAsync(Int32 col)
 at System.Data.SqlClient.SqlBulkCopy.CopyColumnsAsync(Int32 col, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyRowsAsync(Int32 rowsSoFar, Int32 totalRows, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)
 at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)
 at System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table, DataRowState rowState)
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
   --- End of inner exception stack trace ---
 at PX.DbServices.Points.MsSql.MsSqlTableAdapter.BulkCopy(IEnumerable`1 rows, Boolean mayLockTable, ExecutionContext context, Action`1 transferObserver)
 at PX.DbServices.Points.DbmsBase.DbmsTableAdapter.WriteRows(IEnumerable`1 rows, Boolean exclusiveWrite, Action`1 transferObserver)
 at PX.BulkInsert.Provider.TransferTableTask.Executor.Start(DataTransferObserver observer)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.RunSingleTask(TransferTableTask task)
   --- End of inner exception stack trace ---
 at PX.Data.Update.DtObserver.AskHowToRecoverFromError(Exception ex)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.RunSingleTask(TransferTableTask task)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.fetchAndRunNextTask()
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.StartSync()
 at PX.Data.Update.DtObserver.AskHowToRecoverFromError(Exception ex)
 at PX.BulkInsert.Provider.BatchTransferExecutorSync.StartSync()
 at PX.Data.Update.PXSnapshotUploader.UploadSnapshot(ZipArchiveWrapper zip, Point point, FileFormat readFormats, FileFormat writeFormats)
 at PX.Data.Update.PXSnapshotUploader.<>c__DisplayClass6_0.<Start>b__0()
 at PX.Data.Update.DatabaseLock.DatabaseOperation(PXDatabaseProvider provider, Action act, Boolean lockDB, Boolean disableFullText)
 at PX.Data.Update.PXSnapshotUploader.Start()
 at PX.Concurrency.CancellationIgnorantExtensions.RunWithCancellationViaThreadAbort(Action method, CancellationToken cancellationToken)
 at PX.Concurrency.CancellationIgnorantExtensions.<>c__DisplayClass1_0.<ToCancellationViaThreadAbort>b__0(CancellationToken cancellationToken)
 at PX.Concurrency.Internal.PXLongOperationPars.PopAndRunDelegate(CancellationToken cancellationToken)
 at PX.Concurrency.Internal.RuntimeLongOperationManager.PerformOperation(PXLongOperationPars p)


Any updates here. I am having the same issue with a custom column on Address table as well.


@patrickg58  I suggest you to create a support case for immediate help.


I resolved this issue last night. The Destination Tenant on Different Instance needed to have the same customizations published before Importing Snapshot as the Source Tenant at the time of the snapshot. Reference Table at the bottom of the Snapshots: Export and Import help page for more information: https://help.acumatica.com/Wiki/Print.aspx?pageid=35882433-8f5b-42e7-abec-bb5116d63dd1


Reply