Opened 3 years ago
Closed 3 years ago
#2842 closed defect (fixed)
Correct Ownership of System Inv Record who do not match the accession's ownnership
| Reported by: | Martin Reisinger | Owned by: | Benjamin Haag |
|---|---|---|---|
| Priority: | medium | Milestone: | |
| Component: | Database, Data Updates | Version: | N/A |
| Severity: | Keywords: | ||
| Cc: | Database Engine: | N/A | |
| Operating System: | N/A |
Description
As of 7/20/2023, in NPGSWEB, there are 24,651 accessions whose owner doesn’t match the owner of the system inventory record – and probably should.
This would be an easy fix for the DBA to run a single script. The script below only identifies the accessions.
SELECT a.accession_id
FROM accession a
JOIN inventory i ON i.accession_id = a.accession_id
WHERE i.form_type_code = ''
AND
a.owned_by != i.owned_by
The following script (per Kurt) could be used to correct existing cases:
UPDATE i
SET i.owned_by = a.owned_by
FROM accession a
JOIN inventory i ON i.accession_id = a.accession_id AND i.form_type_code = ''
WHERE a.owned_by != i.owned_by

Ran verification script; data is correct. Will make note to run report on regular basis.