Re: Find and Replace All

From: Sean Davis <sdavis2(at)mail(dot)nih(dot)gov>
To: chelsea boot <scx6148(at)yahoo(dot)co(dot)uk>, <operationsengineer1(at)yahoo(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Find and Replace All
Date: 2006-03-17 13:31:36
Message-ID: C0402468.85C3%sdavis2@mail.nih.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 3/17/06 8:25 AM, "chelsea boot" <scx6148(at)yahoo(dot)co(dot)uk> wrote:

> Thanks - I've used PGAdmin to update the tables before but as there is a few
> of them I wanted to save time. I was looking at the UPDATE command but didn't
> know how to (1) select only part of a field to update eg. update
> d:\upkeep\jones to r:\upkeep\jones and (2) search all columns and all tables.
> Am I looking at the right command?

Updates can only be done on a table-by-table basis. You could write a
script or use a word processor to generate a script to do the updates you
like for each table and then feed that file into psql or just paste it into
the pgAdminIII window.

You cannot update only part of a field. An update can be viewed as a
replacement of an old value with a new one. If you have an old value and
want to replace it with a new one, you will need to find a function that
manipulates the old data to the new. See, for example, here:

http://www.postgresql.org/docs/8.1/interactive/functions-string.html

For the example you give above, look at using replace or concatenate and
trim.

Sean

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message operationsengineer1 2006-03-17 20:49:29 Re: Postgres crashes
Previous Message chelsea boot 2006-03-17 13:25:11 Re: Find and Replace All