Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #31268

    Up to no we have not used the patient number field (unique reference number URN)) but have just left it blank. We are now considering using it.

    Is there a way of populating all the existing patients on the database with a unique reference number (URN)? Then providing each new patient automatically with a URN?

    Tony Taylor


    This was a tricky one to work out, but here is the SQL which can be executed from the “TOOLS | Advanced DB Operation” screen :-

    update per set code=null;
    create temp sequence temp_patient_code minvalue 1;
    update per set code=nextval('temp_patient_code') where ispatient=true;
    drop sequence temp_patient_code;

    What does it do? Well it basically creates a temporary “sequence” (i.e. an auto-incrementing series) and then assigns a code to every patient in your database.

    (PLEASE NOTE: This will only work in the SERVER EDITION of ClinicOffice as the SQL is too advanced for database used in the Startup or Professional Editions.)


    Many thanks this did exactly what we needed

    15700 rows updated in 40 seconds

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.