Import-NAVData gives error on table that does not exist on application database

I’m trying to copy a company from one 18.0 database towards another 18.0 database. these are equal databases without customizations.

I’m getting this error

Import-NAVData : The specified file contains a table with the ID 265 that does not exist in the application database. M
ake sure that you are importing data into the same application as it was exported from.

This table is not used and empty. It is the same in both database, because same version of the base application.

tried this in several ways, bot I’m stuck now.

anyone?

Hi StijnMomm,

Did you ever figure this out?

I have the exact problem on 18.5.
I export-navdata then try to import-navdata using the same database after deleting the company and get the error.

Figured it out, here’s the resolution.

Import-NAVData : The specified file contains a table with the ID xxx that does not exist in the application database

After you get the database upgraded from a C/AL system, there shouldn’t be any Object Metadata in your database under Object ID 2000000000.

Check by looking at SQL.
SELECT TOP (1000) [timestamp]
,[Object Type]
,[Object ID]
,[Metadata]
,[User Code]
,[Metadata Version]
,[User AL Code]
,[Hash]
FROM [dbo].[Object Metadata]
where [Object ID] < 2000000000

Then check the Object Metadata Snapshot.
SELECT TOP (1000) [timestamp]
,[Object Type]
,[Object ID]
,[Name]
,[Data Per Company]
,[Metadata]
FROM [dbo].[Object Metadata Snapshot]
where [Object ID] < 2000000000

My results listed tables:
265 Document Entry
338 Entry Summary
830 DO Payment Card Type
1670 Option Lookup Buffer
1754 Field Content Buffer
7330 Bin Content Buffer
9192 Pending Company Rename

none of these exist in Cronus database (for 18.5)

I found each one in the database and then ran a DROP statement for each.

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N’[dbo].[CompanyName$Document Entry]’) AND type in (N’U’))
DROP TABLE [dbo].[CompanyName$Document Entry]
GO

Then I deleted the extra entries from the Object Metadata Snapshot table.
DELETE FROM [dbo].[Object Metadata Snapshot]
where [Object ID] < 2000000000

Then I restarted the Service Tier. and tested the Export/Import using powershell.

$ServerInstance = “BC180”
$CopyCompany = “CRONUS”
$NewCompanyName = “TestJoe1”
$FilePath = “E:~TempData\TestJoe1.navdata”

Restart-NAVServerInstance -ServerInstance $ServerInstance

Remove-Item -Path $filepath

Copy-NAVCompany -DestinationCompanyName $NewCompanyName -ServerInstance $ServerInstance -SourceCompanyName $CopyCompany

Export-NAVData -ServerInstance $ServerInstance -CompanyName $NewCompanyName -FilePath $FilePath -IncludeApplication -IncludeApplicationData -IncludeGlobalData

Remove-NAVCompany -CompanyName $NewCompanyName -ServerInstance $ServerInstance

Import-NAVData -ServerInstance $ServerInstance -CompanyName $NewCompanyName -FilePath $FilePath -IncludeApplication -IncludeApplicationData -IncludeGlobalData -Force

and it worked!

best of luck,

joe