Converting a Microsoft Dynamics NAV 2013 Database

If your current solution is based on Microsoft Dynamics NAV 2013, you can convert the database to the Microsoft Dynamics NAV 2013 R2 technical requirements, and then upgrade the application and data later.

Warning

You can choose to convert the database and not upgrade your application. However, we recommend that you upgrade the application objects as well so that your solution includes important application fixes and new functionality that is introduced in Microsoft Dynamics NAV 2013 R2. Upgrading the application will also reduce the amount of merging required to upgrade to the next major version of Microsoft Dynamics NAV, bringing you to the latest version of the product faster.

The following list describes the main steps of converting the database:

  1. Prepare the Microsoft Dynamics NAV 2013 database

  2. Convert the Microsoft Dynamics NAV 2013 database

  3. Run the converted database by using Microsoft Dynamics NAV 2013 R2

We recommend that you first convert a test database and test this before you convert any production database. That way, you can create a FOB file in the Microsoft Dynamics NAV 2013 R2 development environment with the objects that you changed and import this FOB file into the converted production databases. You can use this FOB file instead of resolving the compilation issues manually again.

Preparing the Microsoft Dynamics NAV 2013 Database

The first step is to back up your existing Microsoft Dynamics NAV 2013 database and then prepare to convert it. You do this in the Microsoft Dynamics NAV 2013 development environment.

To prepare the Microsoft Dynamics NAV 2013 database

  1. Make a copy of the Microsoft Dynamics NAV 2013 database, or create a backup.

  2. Open the Microsoft Dynamics NAV 2013 development environment, and connect to the Microsoft Dynamics NAV 2013 database that you want to convert.

  3. In the Microsoft Dynamics NAV 2013 development environment, on the Tools menu, choose Build Server Application Objects.

    In the dialog box that appears, choose the Yes button.

  4. If any errors occur, they are shown in the Error List window. Make sure that you address all compilation errors before you continue.

  5. In the Microsoft Dynamics NAV 2013 development environment, on the File menu, point to Database, and then choose Alter.

  6. In the Alter Database window, on the Integration tab, enter a check mark in the Save license in database field.

  7. Choose the OK button, and then, in the dialog that appears, specify the license file that must be uploaded to the database.

    Important

    The license that you upload must be a Microsoft Dynamics NAV 2013 R2 developer license. During the conversion, the Microsoft Dynamics NAV 2013 R2 development environment will convert the report objects that are stored in the Microsoft Dynamics NAV 2013 database to the RDL 2012 format.

Converting the Microsoft Dynamics NAV 2013 Database

Next, you will convert the Microsoft Dynamics NAV 2013 database so that it can be used in Microsoft Dynamics NAV 2013 R2. Before you start the following procedure, you can choose to uninstall Microsoft Dynamics NAV 2013. However, you can install Microsoft Dynamics NAV 2013 and Microsoft Dynamics NAV 2013 R2 in the same environment. When you uninstall Microsoft Dynamics NAV 2013, the database is still attached to the instance of SQL Server, which you can verify using SQL Server Management Studio.

Tip

If you want to write a script that helps you convert databases, you can use the UpgradeDatabase command for the development environment. For more information, see UpgradeDatabase.

To convert the database

  1. Run the installation program for Microsoft Dynamics NAV 2013 R2. Choose to install the Developer option.

  2. Open the Microsoft Dynamics NAV 2013 R2 development environment, and then connect to the Microsoft Dynamics NAV 2013 database that you prepared in the previous section.

  3. In the dialog box that appears, read the instructions carefully because this action cannot be reversed. When you are ready, choose the OK button, and then confirm that you want to convert the database.

    Microsoft Dynamics NAV will now convert the database. This includes an upgrade of system tables, and an upgrade of all reports to support Report Viewer 2010.

  4. When you are notified that the conversion was successful, choose the OK button.

    Important

    You may see a message that some of the reports could not be recompiled during the database conversion. This issue is described in KB 2804640 Code corrections for some Microsoft Dynamics NAV 2013 reports to prevent compilation errors with Report Viewer 2012 when upgrading to later versions of Microsoft Dynamics NAV, which is listed earlier in this topic as a requirement. If you see errors about reports that are specific to this database, you must modify the objects in the original Microsoft Dynamics NAV 2013 database and then start the conversion again.

  5. On the Tools menu, choose License Information.

  6. Choose the Upload button to upload a valid Microsoft Dynamics NAV 2013 R2 license to SQL Server.

  7. In the development environment, on the Tools menu, choose Build Server Application Objects, and then, in the dialog box, choose the Yes button.

  8. If any errors occur, they are shown in the Error List window. Make sure that you address all compilation errors before you continue.

    You can also find all objects which did not compile in the Object Designer window, by setting a field filter on the Compiled field.

After database conversion has completed, you will receive compilation errors in several standard Microsoft Dynamics NAV objects. The following table provides guidance to help you resolve these errors.

Object Type Object ID Object Name Compilation Status Solution

Table

5540

Timeline Event

Error

Update the Subtype property of the variables that reference the DataVisualization add-in with references to the new version of the add-in.

Table

5541

Timeline Event Change

Error

Update the Subtype property of the variables that reference the DataVisualization add-in with references to the new version of the add-in.

Codeunit

9180

Generic Chart Mgt.

Error

Remove the code line that refers to the Company field. This field is obsolete.

Codeunit

9500

Debugger Management

Error

Remove the code lines that refer to the User SID field. This field is obsolete.

Page

692

Import Style Sheet

Error

Rename the ObjectType global variable to ObjType. In Microsoft Dynamics NAV 2013 R2, ObjectType is a reserved word in C/AL.

Page

693

Program Selection

Error

Rename the ObjectType global variable to ObjType. In Microsoft Dynamics NAV 2013 R2, ObjectType is a reserved word in C/AL.

Page

5540

Item Availability by Timeline

Error

Update the Subtype property of the variables that refer to the DataVisualization add-in with references to the new version of the add-in.

Page

9170

Profile Card

Error

Remove the Owner ID column from the page. This field is obsolete.

Page

9171

Profile List

Error

Remove the Owner ID column from the page. This field is obsolete.

Page

9182

Generic Charts

Error

Remove the code line that refers to the Company field. Remove the Company column from the page. This field is obsolete.

Page

9183

Generic Chart Setup

Error

Remove the Company column from the page. This field is obsolete.

Page

9500

Debugger

Error

Remove the code lines that refer to the User SID field. This field is obsolete.

Page

9503

Debugger Watch Value FactBox

Error

Remove the code lines that refer to the User SID field. This field is obsolete.

Page

9504

Debugger Code Viewer

Error

Remove the code lines that refer to the User SID field. This field is obsolete.

Rename the ObjectType global variable to ObjType. In Microsoft Dynamics NAV 2013 R2, ObjectType is a reserved word in C/AL.

Page

9505

Debugger Breakpoint List

Error

Remove the User SID field from the expression in the SourceTableView property. Remove the code lines that refer to the User SID field. This field is obsolete.

Table

79

Company Information

Warning

Several warnings. See the solution in the following section.

Codeunit

40

LogInManagement

Warning

See the solution in the following section.

Codeunit

43

LanguageManagement

Warning

See the solution in the following section.

The following 3 sections provide before and after code that will help you resolve the warnings you receive when you compile the objects.

When you have resolved all compilation warnings, you must compile the system tables. You can find the tables by setting a filter for table ID 2000000004..2000000130.

Before and After Code for Warnings in Table 79

The following table describes the before and after code that will help you resolve the warnings that you receive when you compile table 79 Company Information.

Before

LOCAL PROCEDURE GetDatabaseIndicatorText@9(IncludeCompany@1003 : Boolean) : Text[250];
VAR
  Session@1000 : Record 2000000009;
  Text@1002 : Text[1024]; 
BEGIN
  Session.SETRANGE("My Session",TRUE);
  Session.FINDFIRST;
  Text := Session."Database Name" + ' - ' + Session."Host Name";
  IF IncludeCompany THEN
    Text := COMPANYNAME + ' - ' + Text;
  IF STRLEN(Text) > 250 THEN
    EXIT(COPYSTR(Text,1,247) + '...');
  EXIT(Text)
END;

After

LOCAL PROCEDURE GetDatabaseIndicatorText@9(IncludeCompany@1003 : Boolean) : Text[250];
VAR
  ActiveSession@1000 : Record 2000000110;
  Text@1002 : Text[1024]; 
BEGIN
  ActiveSession.SETRANGE("Server Instance ID",SERVICEINSTANCEID);
  ActiveSession.SETRANGE("Session ID",SESSIONID);
  ActiveSession.FINDFIRST;
  Text := ActiveSession."Database Name" + ' - ' + ActiveSession."Server Computer Name"; 
  IF IncludeCompany THEN
    Text := COMPANYNAME + ' - ' + Text;
  IF STRLEN(Text) > 250 THEN
    EXIT(COPYSTR(Text,1,247) + '...');
  EXIT(Text)
END;

Before and After Code for Codeunit 40

The following tables describe the before and after code that will help you resolve the warnings that you receive when you compile codeunit 40 LogInManagement.

Before

User@1003 : Record 2000000120;

After

User@1003 : Record 2000000120 SECURITYFILTERING(Filtered);

Before

Language.SETRANGE("STX File Exist",TRUE);

After

Language.SETRANGE("Localization Exist",TRUE);

Before and After Code for Codeunit 43

The following table describes the before and after code that will help you resolve the warnings that you receive when you compile codeunit 43 LanguageManagement.

Before

Language.SETRANGE("STX File Exist",TRUE);

After

Language.SETRANGE("Localization Exist",TRUE);

Running the Converted Database by using Microsoft Dynamics NAV 2013 R2

When you have resolved all compilation errors and warnings, you can test the converted database by using it with Microsoft Dynamics NAV 2013 R2.

Important

Before you start the Microsoft Dynamics NAV Server instance, make sure that the service account that the Microsoft Dynamics NAV Server instance uses has the db_owner role for the database.

To run the converted database by using Microsoft Dynamics NAV 2013 R2

  1. Start the Microsoft Dynamics NAV Server Administration tool.

  2. Navigate to the Microsoft Dynamics NAV Server instance that you want to access the converted database, and then choose the Edit button.

  3. On the General FastTab, change the following fields to point at the converted database:

    • Database Instance

    • Database Name

    • Database Server

  4. Choose the Save button, and then, in the dialog box that appears, choose the OK button.

  5. In the left pane, choose the Microsoft Dynamics NAV Server computer where the modified service instance runs.

    Unless you are administering a remote computer, this is Microsoft Dynamics NAV (local).

  6. In the central pane, right-click the service instance that you modified, and then choose Restart.

    This stops and restarts the service instance, and the service instance now connects to the converted database.

  7. To verify that the Microsoft Dynamics NAV Server instance accesses the converted database, open the Microsoft Dynamics NAV Windows client and connect to the modified Microsoft Dynamics NAV Server instance.

You have now completed the conversion of your Microsoft Dynamics NAV 2013 database to be accessed from Microsoft Dynamics NAV 2013 R2. Next, upgrade the application code to Microsoft Dynamics NAV 2013 R2.

See Also

Concepts

Upgrading the Application Code
Upgrading the Data
Automating the Upgrade Process using Sample Windows PowerShell Scripts

Other Resources

Upgrading to Microsoft Dynamics NAV 2013 R2