dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #00524
help me on how to use replace<id> syntax
Thanks for the quick help,
i have successfully used the select and delete steps(in datavalues and datavalue_audit) but using replace <id> is not working on my side may be am not using it well? please update me again (only replace syntax). i have deleted data from my data element x and next step was to use replace but am getting syntax error! and if i check my data in data entry form i find no data and if i delete the data element in an interface next time i get error message for the unreplaced id when i open the form.
waiting for your help dear team!
________________________________
Muhire Andrew
HMIS/Ministry of Health
andrew.muhire@xxxxxxxxxx
God is my provider.
________________________________
From: Jason Pickering <jason.p.pickering@xxxxxxxxx>
To: Muhire Andrew <muhireandrew@xxxxxxxxx>
Cc: Knut Staring <knutst@xxxxxxxxx>; Lars Helge Øverland <larshelge@xxxxxxxxx>; "dhis2-users@xxxxxxxxxxxxxxxxxxx" <dhis2-users@xxxxxxxxxxxxxxxxxxx>; "dhis2-devs@xxxxxxxxxxxxxxxxxxx" <dhis2-devs@xxxxxxxxxxxxxxxxxxx>
Sent: Monday, September 12, 2011 4:13 PM
Subject: Re: [Dhis2-devs] Dear Dhis2 users how can i delete?
It is best practice in all cases to ensure to you make a backup of your database. Even with SELECT and DELETE, you may unknowingly make a typing mistake. Anytime you start messing around with the database directly, ensure you first make a backup, so that you can easily restore the database in case you mess up something unintentionally.
Another trick is to use a "SELECT INTO " statement, to put all of the data you are about to delete into a separate table, and then perform the delete operation. This way, it is relatively easy to see what you have deleted and restore it once again, without reverting to a complete backup restore.
Regards,
Jason
2011/9/12 Muhire Andrew <muhireandrew@xxxxxxxxx>
Thank you all,
>Great Knut its rilly good to select first and then delete because it can cause problems in case i delete the needed data.
>
>
>
>
>
>________________________________
>
>
>
>Muhire Andrew
>
>HMIS/Ministry of Health
>andrew.muhire@xxxxxxxxxx
>God is my provider.
>
>
>
>
>
>________________________________
>From: Knut Staring <knutst@xxxxxxxxx>
>To: Lars Helge Øverland <larshelge@xxxxxxxxx>
>Cc: Muhire Andrew <muhireandrew@xxxxxxxxx>; dhis2-users@xxxxxxxxxxxxxxxxxxx; dhis2-devs@xxxxxxxxxxxxxxxxxxx
>Sent: Monday, September 12, 2011 3:56 PM
>Subject: Re: [Dhis2-devs] Dear Dhis2 users how can i delete?
>
>
>
>As a rule of thumb, it is usually wise to do a SELECT before a DELETE, so that you are 100% sure you are not deleting data you really need.
>
>
>In this case:
>
>
>select * from datavalue_audit where dataelementid=<id>;
>select * from datavalue where dataelementid=<id>;
>
>
>Knut
>
>
>2011/9/12 Lars Helge Øverland <larshelge@xxxxxxxxx>
>
>Hi Andrew,
>>
>>you need to remove the data with SQL in the database. Run:
>>
>>delete from datavalue_audit where dataelementid=<id>;
>>delete from datavalue where dataelementid=<id>;
>>
>>and replace <id> with the dataelementid of the one you want to remove.
>>
>>You can then go ahead and delete the data element in the user interface.
>>
>>
>>
>>Lars
>>
>>_______________________________________________
>>Mailing list: https://launchpad.net/~dhis2-devs
>>Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>Unsubscribe : https://launchpad.net/~dhis2-devs
>>
>>More help : https://help.launchpad.net/ListHelp
>>
>
>
>
>--
>
>Knut Staring
>Informatics, U. of Oslo
>http://hisp.uio.no
>+4791880522
>
>
>
>_______________________________________________
>Mailing list: https://launchpad.net/~dhis2-devs
>Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>Unsubscribe : https://launchpad.net/~dhis2-devs
>More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References