Error in Sync-NAVTenant

weneedweneed Member Posts: 82
I am updating a version from NAV2015 to BC22 so I'm performing the first step that upgrades to version BC14.
When execute Sync-NAVTenant -ServerInstance DemoInstance system return this error:

Sync-NAVTenant : The following SQL error was unexpected:
String or binary data would be truncated.
The statement has been terminated.
At line:1 char:1
+ Sync-NAVTenant -ServerInstance DemoInstance
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (0:Int32) [Sync-NAVTenant], NavCommandException
+ FullyQualifiedErrorId : MicrosoftDynamicsNavServer$DemoInstance,Microsoft.Dynamics.Nav.Management.Cmdlets.SyncNavTenant

In the event log find more details:

Message:
The following SQL error was unexpected:
String or binary data would be truncated.
The statement has been terminated.
SQL statement:
ALTER TABLE dbo."COMPANY_DEMO$SOTTOSCRITTORI" ALTER COLUMN "Nr_ Rapporto" NVARCHAR(20) COLLATE Latin1_General_100_CI_AS NOT NULL;


In this table, there is a field whose size has been reduced from 20 to 10 characters but this has been handled in the upgrade codeunit:

DataUpgradeMgt.SetTableSyncSetup(DATABASE::"SOTTOSCRITTORI",0,TableSynchSetup.Mode::Force);

Why then am I getting this error that should instead be handled by the statement in the upgrade codeunit?
If I remove the statement from the upgrade codeunit, the displayed error is different (as expected):

Table: 50000, SOTTOSCRITTORI
Field: 10, "Nr_ Rapporto": Length reduced

Answers

  • DanielGorskiDanielGorski Member Posts: 14
    Which BC14 CU do you use? Is the upgrade codeunit declared correctly? If nothing helps I would recommend to extend the field and reduce it afterwards with forcing.
  • vaprogvaprog Member Posts: 1,140
    I would guess you get that error because the column (or even some other column in that table contains invalid UCS-2 or UTF-16 data (whichever your database is using).
    I am not enuogh of an SQL expert to know how to check for this and much less how to correct it.
Sign In or Register to comment.