[Solved] Batch Change Field Contents?

Creating tables and queries
Post Reply
User avatar
kabing
Volunteer
Posts: 678
Joined: Fri Nov 23, 2007 12:05 am
Location: Midwest, USA

[Solved] Batch Change Field Contents?

Post by kabing »

I discovered the other day that I need to change all the records with a country field entry of "USA" to "US". It seems to me that I've seen a way to do that with the SQL tool, but searching the forums hasn't turned up the post I thought I remembered. Is there a way to do this...aside from changing each record by hand, that is.

Thanks,

Kabing
Last edited by kabing on Wed May 14, 2008 11:53 pm, edited 1 time in total.
NeoOffice (app store version) OpenOffice.org 4.1 and LibreOffice 4.3 on Mac OS X El Capitan
OpenOffice.org 4.1.2 on Windows 10 (Previously on Vista)
newuser
Posts: 39
Joined: Sun Dec 02, 2007 11:06 am

Re: Batch Change Field Contents?

Post by newuser »

I don't use HSQLDB but the command should be something like:

Code: Select all

UPDATE mytable SET fieldname = "US" WHERE fieldname = "USA"
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Batch Change Field Contents?

Post by Villeroy »

Code: Select all

UPDATE "mytable" SET "fieldname" = 'US' WHERE "fieldname" = 'USA'
Single quotes denote literal strings, double quotes denote database names.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
kabing
Volunteer
Posts: 678
Joined: Fri Nov 23, 2007 12:05 am
Location: Midwest, USA

Re: [solved] Batch Change Field Contents?

Post by kabing »

Thanks so much! It worked perfectly!

kabing
NeoOffice (app store version) OpenOffice.org 4.1 and LibreOffice 4.3 on Mac OS X El Capitan
OpenOffice.org 4.1.2 on Windows 10 (Previously on Vista)
Post Reply