Re: Only updating part of a column - Mailing list pgsql-general

From Thomas Lockhart
Subject Re: Only updating part of a column
Date
Msg-id 397D2954.9818573F@alumni.caltech.edu
Whole thread Raw
In response to Only updating part of a column  (Dave Smith <dave@candata.com>)
List pgsql-general
> I would like to know if I can update part of a column. ie
> update myfile set substr(direct_key,1,10)='1234567890' where
> substr(direct_key,1,10)='0987654321';

update myfile
  set direct_key = '1234567890' || substring(direct_key from 11)
  where substring(direct_key from 1 for 10) = '0987654321';

Note that you can use substr() also...

                    - Thomas

pgsql-general by date:

Previous
From: Ian Turner
Date:
Subject: function language type?
Next
From: Tom Lane
Date:
Subject: Re: 4 billion record limit?