X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3AE34DB966 for ; Thu, 17 Nov 2005 20:08:13 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 87242-04 for ; Fri, 18 Nov 2005 00:08:15 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from priv-edtnes57.telusplanet.net (outbound01.telus.net [199.185.220.220]) by svr1.postgresql.org (Postfix) with ESMTP id 433F9D71C6 for ; Thu, 17 Nov 2005 20:08:05 -0400 (AST) Received: from [192.168.0.16] (really [207.6.233.91]) by priv-edtnes57.telusplanet.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with ESMTP id <20051118000808.ZSVF14467.priv-edtnes57.telusplanet.net@[192.168.0.16]>; Thu, 17 Nov 2005 17:08:08 -0700 In-Reply-To: <437D1862.2060402@PresiNET.com> References: <1132269492.30942.20.camel@dev11dt.corp.localmatters.com> <5d001d303f001ea0847254c3f0a352d9@squeegeemedia.com> <437D1862.2060402@PresiNET.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: pgsql-sql@postgresql.org From: Dawn Buie Subject: Re: how to do a find and replace Date: Thu, 17 Nov 2005 16:08:07 -0800 To: Bricklen Anderson X-Mailer: Apple Mail (2.623) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/141 X-Sequence-Number: 23392 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. > _______________________________ >