Update a SQL Server Database

Update an Ape Software SQL Server Database

Use these instructions to update the database structure of a Calibration Control (our Calibration Management Software) database installed on a SQL Server 2016 or higher.  These instructions are to update an existing database already installed on SQL Server and configured & connected for Calibration Control.

Before Updating

Open SQL Server Management Studio (SSMS) and sign in to a SQL Server as a SYSTEM ADMIN because you'll require enough permissions to create and update databases and their objects.  Otherwise, your IT Group may need to perform the database update.

► All of the SQL files needed to update your SQL Server Database reside in the SQL Tools program files folder once the updated software version is installed.

SQL Tools Program Folder

Before attempting to update an apecal database, protect your database with a backup . To do so, right-click the database in SSMS, hover over Tasks, and then select 'Back Up'.  Follow along with our Backup/Restore SQL Server Database help topic for more detailed instructions.

Backup SQL Database


Updating the Database

Identify the current Structure Version

  1. First, you must determine the current database structure version before updating it.  From SSMS, expand the database tree and expand the Tables folder.  Right-click the dbo.tblDBVersion_DO_NOT_EDIT table, and click 'Select Top 1000 rows'.  There should only be one record and it provides the current DB structure version number, from which it's easy to identify which of the update scripts will be needed.

    Check Current Version

    Note (applies to Calibration Control versions 7.2.5 and older):  If you do have a StructureVersion field within the SQL file name, use the following table as your guide to interpret the dbo.tblDBVersion table and how to choose the appropriate sql_update SQL file to begin with:

    DB Version Interpretation

    Indication Database Version
    dbo.tblDBVersion_DO_NOT_EDIT table does not exist 1
    Rev = 1.1, 7.0, 7.0.1, etc. Rev = Version
    Rev = DoNotEdit Use StructureVersion field
    StructureVersion = 66 66
  2. (Once again, ensure you have backed up your database before proceeding.)  Next, open each of the SQL Update files with SQL Server Management Studio (SSMS).  Refer to the above Program files SQL Tools folder location.  
  3. Using a Custom DB Name?  Note: If your database name is not the standard "apecal", either (a) rename the current copy of the database to 'apecal' before proceeding, or (b) modify the default DB name in all instances throughout the script to use your custom database name before executing.  It may appear in the update files as the following lines:
  4. ALTER DATABASE apecal -- ***
    SET OFFLINE WITH ROLLBACK IMMEDIATE
    ALTER DATABASE apecal -- ***
    SET ONLINE
    USE apecal -- ***
    GO
    ALTER DATABASE apecal SET PAGE_VERIFY CHECKSUM -- ***
    GO

  5. Finally, apply the sql_update SQL files in their sort order beginning with the database version indicated by the Db Version table (above).  (This can be done by drag & drop file method from the SQL Tools Folder into SSMS.) 

    Here is an example of following the sort order by the StructureVersion of the database:

    ► If the StructureVersion field value of your database equals 66, then begin with the corresponding file name, sql_update_22 (db ver 66 to 73).sql  and click the [Execute] button to apply the change.

    Note:  Ensure that none of the text in the SQL file is actually highlighted when the [Execute] button is pressed because this selection will run only that highlighted text.

  6. Once the query is complete (without any red query errors), continue to the next file until you finish with the final SQL file. 
  7. If you encounter any query errors, take a screenshot of the error(s) and contact us for assistance.

List of Updates

SQL Update Script File
sql_update_01 (pgm ver 1 to 1.1).sql  (read as version 1.0 to 1.1)
sql_update_02 (pgm ver 1.1 to 7.0).sql  (same as above)
sql_update_03 (pgm ver 7.0 to 7.0.1).sql
sql_update_04 (pgm ver 7.0.1 to 7.2.0).sql
sql_update_05 (pgm ver 7.2.0 to 7.2.2).sql
sql_update_06 (pgm ver 7.2.2 to 7.2.5).sql
sql_update_07 (pgm ver 7.2.5 to 7.2.5.8).sql
sql_update_08 (pgm ver 7.2.5.8 to db ver 15).sql  (read as program version 7.2.5.8 to database version 15 {new system})
sql_update_09 (db ver 15 to 24).sql  (read as database version 15 to 24)
sql_update_10 (db ver 24 to 30).sql
sql_update_11 (db ver 30 to 31).sql
sql_update_12 (db ver 31 to 38).sql
sql_update_13 (db ver 38 to 39).sql
sql_update_14 (db ver 39 to 40).sql
sql_update_15 (db ver 40 to 41).sql
sql_update_16 (db ver 41 to 42).sql
sql_update_17 (db ver 42 to 43).sql
sql_update_18 (db ver 43 to 46).sql
sql_update_19 (db ver 46 to 51).sql
sql_update_20 (db ver 51 to 64).sql
sql_update_21 (db ver 64 to 66).sql
sql_update_22 (db ver 66 to 73).sql
sql_update_23 (db ver 73 to 81).sql
sql_update_24 (db ver 81 to 84).sql
sql_update_25 (db ver 84 to 92).sql
sql_update_26 (db ver 92 to 93).sql
sql_update_27 (db ver 93 to 95).sql

Get Ape Support

Contact us and we can setup a screen share and update your database together or if you prefer, you can send us a backup of your database and we can update your database for you.


Last Updated:  29 September 2022