MedicalDirector Knowledge Base
HCN SQL Repair Scripts Using SQL Server Management Studio

See also: HCN SQL Repair Scripts Using Pracsoft Installation Manager Mechanic

Before you Begin

o      This procedure is valid for MedicalDirector Clinical, Pracsoft, and Bluechip. If you run Clinical / Pracsoft, but do not have SQL Server Management Studio, follow the guide for Pracsoft Installation Manager Mechanic instead.

o      Before attempting this procedure, you should ensure that you have the relevant SQL script(s) on hand.

o      The procedure assumes that ‘SERVER\HCNSQL07’ is the SQL server name. You will need to substitute this with the correct SQL server name when following these instructions (i.e. ComputerName\HCNSQL07).

o      If you are not sure of the correct SQL Server name that is used by the surgery, it can be found by opening Bluechip and selecting Help > About  (listed under location).

o      This is an advanced procedure, and if at any time you are unsure or would like assistance please don’t hesitate to contact Customer Service on 1300 300 161.


o      Obtain the SQL script(s) from the email attachments prior to performing the procedure.

o      Steps 6 to 9 will need to be performed for each SQL ‘repair’ script, unless otherwise directed

It has come to MedicalDirector’s attention that downloading the script attachments via WebMail interfaces may damage the repair script(s). With this in mind it is recommended to use a POP3 email client (such as Outlook / Outlook Express) to download the attachment(s) to your computer.

If a repair script has been damaged, an error will be displayed during Step 8 (Execute SQL Script phase).  If an error occurs you will need to download the repair script again (using an email client) and re-run from Step 6. If the error continues to appear, you should contact MedicalDirector Customer Service to discuss other alternatives.

Procedure List

The following procedure will need to be performed on the server whilst MedicalDirector applications have been closed on all machines.

1.      Ensure that all users have exited all MedicalDirector applications on their computers.

2.      Create a full backup including documents.

o      Backup for Clinical / Pracsoft

o      Backup for Bluechip


3.      Save the script email attachment(s) to a location on your hard drive (e.g. the My Documents folder).

4.      Start the SQL Server Management Studio.

o      From the Windows Start menu, Select All Programs.

o      From the All Programs window, locate Microsoft SQL Server; click the SQL Server Management Studio.


5.      Once SQL Server Management Studio has opened, you will be presented with a Connect to Server window, check the following is correct then click Connect.

o      Server Type: Database Engine.

o      Server name: Server Name/HCNSQL07 (as shown in the location in Bluechip Help > About).

o      Authentication: Windows Authentication


6.      You will now be presented with the Object Explorer Screen. Browse to the location on the local hard drive of the saved Script in Step 3 (i.e. the My Documents folder).

o      Double click the script file ‘ ID0000 – Script Name, you will now be presented with the SQL Server Management Studio window.


7.      Locate drop down box next to the Exclamation button (!)

o      Using this drop down box select the Bluechip OR HCN database. Relevant to the program you received the script for.


8.      Click the Execute button.

9.      Once the Script has been run successfully, save the logs.

o      Click in the Results (Messages) pane.

o      On the Menu click File, select Save Results As, you will be prompted with the Save Results window.

o      Browse to the location on the local hard drive where you would like to save the results.

o      Save with the file name of ‘Script Today’s Date’ e.g. Script 14042012 click Save.


10.   Close all programs back to the desktop.

11.   Delete the script from the computer that was saved in step 3. This script should never be run again without recommendation by Customer Service. To remove the file:

o      Open Windows Explorer.

o      Browse to the location where you saved the file.

o      Locate and highlight the file.

o      Press the Delete key on the keyboard and select Yes to deleting the file.


12.   Open the MedicalDirector application and open the relevant module that experienced the problems.

o      If you are satisfied the data is correct, create another FULL MedicalDirector Backup (created via MedicalDirector Bluechip Backup - Restore) and continue using Bluechip.

o      If you are NOT satisfied, restore the backup created in Step 2 and contact MedicalDirector Customer Service.