
Environment
The problem
After the migration, table 5600 "Fixed Asset" contains about 1,038 records (out of ~23,320) whose primary key ("No." field) contains invalid/hidden bytes at the SQL level. The keys look normal on screen but do not match when looked up by primary key. Importantly, every other module migrated cleanly and has been running without issue for the last 4 months — this corruption is isolated to Fixed Assets.
Symptoms:
KDFF7857, two CM003LHFF2166.How I diagnosed it (with AL)
FindSet returns each record fine, but calling Rec.Get("No.") with the displayed value returns nothing — and where it does return a row, its SystemId differs from the looped record. So the on-screen key ≠ the key stored in SQL.UpperCase(DelChr("No.",'<>',' '))) shows no difference — reads come back already normalized, so the bad bytes are only visible at the database layer, not to AL.Everything I have tried — all fail
GetBySystemId then Delete) → fails.FindSet scan can read the corrupt rows), then DeleteAll on 5600, then re-insert clean → fails at DeleteAll with "Sorry, we just updated this page. Reopen it, and try again." (optimistic concurrency — the row-by-row delete matches 0 rows on the phantom records).Rec.Truncate method (2025 wave 2) → not usable here. Per Microsoft's own documentation, Truncate does not support tables with OnDelete triggers/event subscriptions (both 5600 and 5612 have OnDelete triggers) or tables with media fields (5600 has the "Image" Media field). So it errors / is unavailable on these tables.So every application-layer method is blocked: Delete, Rename, DeleteAll, and Truncate.
What I think the cause is
NAV 2009 R2 stored Code fields differently (space padding, older SQL collation). I suspect those "No." values carried trailing spaces / control characters / collation-specific bytes that were valid in NAV 2009 R2, survived each upgrade step, and only became invalid primary keys once the data reached BC online (Azure SQL). The source databases are decommissioned, so I can't check the original collation.
My questions to the community
I have the full list of 1,038 affected "No." values and a temporary read-only "Safe View" page in place so users can still see the ~22,282 healthy assets in the meantime.Any guidance appreciated — thank you!