Question

Error import snapshot

  • 11 October 2023
  • 2 replies
  • 117 views

Userlevel 3
Badge

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: GLTran. 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 'GLTran' 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: GLTran. 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)


2 replies

Userlevel 7
Badge +12

Hi @kevinheng21 

Basically this issue happen when there is no space to Import the data.

Please do the following activities

.1. Optimize data base

  1. reset caches
  2. make sure you have enough space
  3. restart the application
  4. reimport the snapshot

Acumatica can allow to import the data below 2GB, 

 

Userlevel 7
Badge +9

Hi @kevinheng21 The mentioned error “System.InvalidOperationException: String or binary data would be truncated.” occurs when you have a customization of field in the database that has increased the Character length of the field.

Please try the following:
1. Publish the customization first in the instance,

2. Import the snapshot.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved