Database restore error: "Cannot alter table"

lospetlospet Member Posts: 42
Hello,

I was upgrading our dynamics NAV system from version 4.0 -> 5.0. After I merged all my modified tables with the new tables I was going to restore our custom database. During the restore I receive the following error:

The following SQL Server error(s) occurred while accessing the Currency table:

4902,"42S02",[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot alter table 'DynamicsNavRazvoj_ver50SP1.dbo.Teched d_o_o_$Currency' because this table does not exist in database 'DynamicsNavRazvoj_ver50SP1'.

SQL:
ALTER TABLE "DynamicsNavRazvoj_ver50SP1"."dbo"."Teched d_o_o_$Currency" ADD CONSTRAINT "Teched d_o_o_$Currency$0" PRIMARY KEY CLUSTERED ("Code")


Can anyone help me with this problem. Is this problem a result of a wrong upgrade process?

Kind regards,
lospet

Comments

  • JedrzejTJedrzejT Member Posts: 267
    Is there a diffrence in DataPerCompany properties of this table beetween custom database object and restoring objects?
  • lospetlospet Member Posts: 42
    JedrzejT,
    in both tables the DataPerCompany property is set to 'yes'.

    Regards,
    lospet
  • kinekine Member Posts: 12,562
    And does the table exists on the SQL or not?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • lospetlospet Member Posts: 42
    Yes, it does exist.

    lospet
  • kinekine Member Posts: 12,562
    1) Are you restoring the DB as Sysadmin or DB_Owner? (is used account set as sysadmin or db_owner on the SQL server)?
    2) Is owner of this table dbo or another account?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • danielecacchidanielecacchi Member Posts: 13
    I have the same error with Nav50 (build 24199).

    I have a complete NAV backup and I'm trying to restore only a company data (not objects).
    I'm using a sysadmin profile , but at the end of the restore I've got the authoriation error about ADD COSTRAINT for a clustered key on a added setup table.

    After the error I can use SSManagement Studio (connecting with the same NAV profile) and see that the table is present (dbo schema) and that also the clustered key is present.

    But if I try to continue the restore , I have the same error.
    Does anyone have a suggestion ?
    Thank you in advance
  • mark0038mark0038 Member Posts: 2
    We had the same problem. Here the solution:
    You have object in the database how are compiled in a older version of Navision. Mark all objects and compile them. Then it works for sure
    Mark
Sign In or Register to comment.