Re: how to do a find and replace

From: Dawn Buie <dawn(at)squeegeemedia(dot)com>
To: Bricklen Anderson <BAnderson(at)PresiNET(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to do a find and replace
Date: 2005-11-18 00:08:07
Message-ID: be1d8fb1d0b1bb5cf79b8e73b66b5609@squeegeemedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I used:

update media_instance set location=replace(location,'v.','')
where location like '%/0/v.%'

and that did work-

thank you very much.

it seems to me that the replace function is the same as translate()- no?

On 17-Nov-05, at 3:55 PM, Bricklen Anderson wrote:

> Dawn Buie wrote:
>> Hello-
>> I'm using postgres 7.4
>>
>> I have a column of data with the wrong prefix for many items.
>>
>> The wrong entries are entered ' /0/v.myimage.jpg'
>> While the correct ones are ' /0/myimage.jpg'
>>
>>
>> I need to remove all the 'v.' characters from this column.
>>
>>
>> I'm able to do a
>>
>> SELECT * FROM myTable
>> WHERE location = '%/0/v.%'
>>
>>
>> I'm just confused about how I should write code to update the selected
>> items to remove the 'v.'
>>
>> Would I use substring? An example would be much appreciated.
>>
>> thank you
>> Dawn
>
> How about update myTable set location=replace(location,'v.','');
>
> --
> _______________________________
>
> This e-mail may be privileged and/or confidential, and the sender does
> not waive any related rights and obligations. Any distribution, use or
> copying of this e-mail or the information it contains by other than an
> intended recipient is unauthorized. If you received this e-mail in
> error, please advise me (by return e-mail or otherwise) immediately.
> _______________________________
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bricklen Anderson 2005-11-18 00:12:37 Re: how to do a find and replace
Previous Message Bricklen Anderson 2005-11-17 23:55:14 Re: how to do a find and replace