-
-
Save gsherman/3e99d267b997840987a253d1299dc269 to your computer and use it in GitHub Desktop.
redact a contact and the cases for this contact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- redact a contact and the cases for this contact | |
-- set the objid of the contact | |
declare @contactObjid int = 268436230; | |
-- set the redacted verbiage | |
declare @redacted varchar(100) = 'REDACTED'; | |
-- contact name and phone | |
update table_contact set first_name = @redacted, last_name = @redacted, e_mail=@redacted, phone = 'Phone REDACTED-' + CAST(objid AS varchar(20)) where objid = @contactObjid | |
-- contact notes | |
update table_notes_log set description = @redacted where notes_log2contact = @contactObjid | |
--case history, case title | |
update table_case set case_history = @redacted, title = @redacted where case_reporter2contact = @contactObjid | |
--case notes | |
update table_notes_log set description = @redacted where case_notes2case in (select objid from table_case where case_reporter2contact = @contactObjid ) | |
-- case phone notes | |
update table_phone_log set notes = @redacted where case_phone2case in (select objid from table_case where case_reporter2contact = @contactObjid ) | |
-- case email logs | |
update table_email_log set message = @redacted, x_subject = @redacted, recipient = @redacted, cc_list=@redacted where case_email2case in (select objid from table_case where case_reporter2contact = @contactObjid ) | |
-- case research logs | |
update table_resrch_log set notes = @redacted where case_resrch2case in (select objid from table_case where case_reporter2contact = @contactObjid ) | |
-- close case logs | |
update table_close_case set summary = @redacted where objid in | |
( | |
select cc.objid from table_close_case cc, table_act_entry ae | |
where act_entry2case in | |
(select objid from table_case where case_reporter2contact = @contactObjid ) | |
and close_case2act_entry = ae.objid | |
) | |
-- update contact and case timestamps, so seeker index will be updated | |
update table_contact set update_stamp = getdate() where objid = @contactObjid | |
update table_case set modify_stmp = getdate() where case_reporter2contact = @contactObjid | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment