We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

UPDATING SUBJECT_ID

Hello!
I just have a number of subject i want to update there subject study id, personal id and Secondary id
using SQL statement. Any advice is highly appreciated.
Regards,
Evarist.

Comments

  • zwets-kcrizwets-kcri Posts: 50
    Evarist,
    On 13 Dec 2012, at 12:54, Evarist B. Msaki wrote:
    > I just have a number of subject i want to update there subject study id, personal id and Secondary id
    > using SQL statement. Any advice is highly appreciated.
    The SQL to achieve the last two would be
    UPDATE study_subject SET label = 'new label' WHERE label = 'old label';
    UPDATE study_subject SET secondary_label = 'new sec label' WHERE [some condition to select the subject];
    Updating a subject's study id would amount to reassigning it to a different study or site, which I think you shouldn't be doing at data level. Of course if you want to, the statement is analogous to the other two.
    Do note that *any* poking around in the database - even seemingly innocuous statements such as the above - may break your OC instance and/or your GCP compliance. If there is a use case for what you are trying to achieve, better submit a feature request at issuetracker.openclinica.com.
    Best regards,
    Marco
    --
    Marco van Zwetselaar
    KCRI - Kilimanjaro Clinical Research Institute
    Moshi
    Tanzania
    e [email protected]
    m +255 782 334124
    On 13 Dec 2012, at 12:54, Evarist B. Msaki wrote:
    > Hello!
    >
    > I just have a number of subject i want to update there subject study id, personal id and Secondary id
    > using SQL statement. Any advice is highly appreciated.
    >
    > Regards,
    > Evarist.
    >
  • GerbenRienkGerbenRienk Posts: 808 ✭✭✭
    Hello Evarist,
    The most important part of Marco's reply is the second part: use this only
    as a very ultimate last solution!
    Having said that: if you apply the suggested SQL-statement, you run the
    (very small) risk of updating more than you want:
    label and secondary_label are unique at StudyLevel, but not at
    OpenClinica-level.
    So if you use these statements, you can update the records of Subjects in
    other Studies as well. Use the study_subject_id in your where-clause to be
    100% sure.
    Kind regards,
    Gerben Rienk
    > > Evarist,
    > >
    > > On 13 Dec 2012, at 12:54, Evarist B. Msaki wrote:
    >> >> I just have a number of subject i want to update there subject study id,
    >> >> personal id and Secondary id
    >> >> using SQL statement. Any advice is highly appreciated.
    > >
    > > The SQL to achieve the last two would be
    > >
    > > UPDATE study_subject SET label = 'new label' WHERE label = 'old
    > > label';
    > > UPDATE study_subject SET secondary_label = 'new sec label' WHERE [some
    > > condition to select the subject];
    > >
    > > Updating a subject's study id would amount to reassigning it to a
    > > different study or site, which I think you shouldn't be doing at data
    > > level. Of course if you want to, the statement is analogous to the other
    > > two.
    > >
    > > Do note that *any* poking around in the database - even seemingly
    > > innocuous statements such as the above - may break your OC instance and/or
    > > your GCP compliance. If there is a use case for what you are trying to
    > > achieve, better submit a feature request at issuetracker.openclinica.com.
    > >
    > > Best regards,
    > > Marco
    > >
    > > --
    > > Marco van Zwetselaar
    > > KCRI - Kilimanjaro Clinical Research Institute
    > > Moshi
    > > Tanzania
    > > e [email protected]
    > > m +255 782 334124
    > >
    > >
    > >
    > >
    > > On 13 Dec 2012, at 12:54, Evarist B. Msaki wrote:
    > >
    >> >> Hello!
    >> >>
    >> >> I just have a number of subject i want to update there subject study id,
    >> >> personal id and Secondary id
    >> >> using SQL statement. Any advice is highly appreciated.
    >> >>
    >> >> Regards,
    >> >> Evarist.
    >> >>
This discussion has been closed.