Hi,

On Thu, Mar 01, 2007 at 05:22:42PM +0100, Obiajulu Odu wrote:
> I would like to update all the dc.type values in all items in our system
> from "Doctoral Thesis" to "PhD". How can I do that in DSpace 1.4. at the
> postgresql level. 

Before I say anything else, I'm going to insist that you run this on a
test instance first to make sure you get sensible results. I'm not going
to be held responsible if this falls over ;)

Something like this ought to do it (assuming you're running DSpace >=
1.4; if you're running 1.3.2 or earlier, this won't work):

UPDATE metadatavalue
SET text_value='PhD'
WHERE metadata_value_id IN
(
        SELECT metadata_value_id
        FROM metadatavalue mv,
                metadatafieldregistry mfr,
                metadataschemaregistry msr
        WHERE mv.metadata_field_id = mfr.metadata_field_id
                AND mfr.metadata_schema_id = msr.metadata_schema_id
                AND mfr.element = 'type'
                AND msr.short_id = 'dc'
);

However, you should first check that this gives a sensible set of
records to update on your repository by running the nested query:

SELECT *
FROM metadatavalue mv,
        metadatafieldregistry mfr,
        metadataschemaregistry msr
WHERE mv.metadata_field_id = mfr.metadata_field_id
        AND mfr.metadata_schema_id = msr.metadata_schema_id
        AND mfr.element = 'type';
        AND msr.short_id = 'dc'

Cheers,

Jim

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to