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
0
Answers
I am not enuogh of an SQL expert to know how to check for this and much less how to correct it.