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.
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 update.
All of the SQL files needed to update the database reside in the SQL Tools folder under the CC program folder located in your computer at " C:\Program Files (x86)\Ape Software\Calibration Control ".
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.
Updating the Database
Identify the current Structure Version
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.
Note (for much older versions of Calibration Control): If you do not have a StructureVersion field in the file name (i.e, CC versions 7.2.5 and older), then 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:
Next, open each of the SQL Update files with SQL Server Management Studio (SSMS). (Once again, ensure you have backed up your database before proceeding.)
- 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:
- Third, 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 you begin with file sql_update_22 (db ver 66 to 73).sql and click the [Execute] button to apply the changes.
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.
- Once the query is complete (without any red query errors), continue to the next file until you finish with the final SQL file.
- If you encounter any query errors, take a screenshot of the error(s) and contact us for assistance.
ALTER DATABASE apecal -- ***
SET OFFLINE WITH ROLLBACK IMMEDIATE
ALTER DATABASE apecal -- ***
USE apecal -- ***
ALTER DATABASE apecal SET PAGE_VERIFY CHECKSUM -- ***
Get Ape Support
Last Updated: 28 September 2022