From: | "K Parker" <kparker(at)eudoramail(dot)com> |
---|---|
To: | pgsql-general(at)hub(dot)org |
Subject: | Re: update part of a column |
Date: | 2000-07-25 06:23:55 |
Message-ID: | IMCLNHLMONMDBAAA@shared1-mail.whowhere.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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' ....
>
>This does not work. Is this possible?
Not in the way you are attempting to do it.
>Or am I looking at this the wrong way?
Sure: just reassemble the _entire_ column keeping the parts from the original column value that you want to keep, and inserting the new parts you want to insert, e.g.
update myfile set direct_key =
'1234567890' || substr(direct_key,11,10)
where substr(direct_key,1,10) = '0123456789';
Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-07-25 07:14:56 | Re: function language type? |
Previous Message | jprem | 2000-07-25 06:21:43 | nested transactions |