Re: removing a portion of text

From: Lennin Caro <lennin(dot)caro(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org, pere roca <peroc79(at)gmail(dot)com>
Subject: Re: removing a portion of text
Date: 2008-10-20 14:08:03
Message-ID: 436951.23558.qm@web59508.mail.ac4.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

--- On Mon, 10/20/08, pere roca <peroc79(at)gmail(dot)com> wrote:

> From: pere roca <peroc79(at)gmail(dot)com>
> Subject: re[GENERAL] moving a portion of text
> To: pgsql-general(at)postgresql(dot)org
> Date: Monday, October 20, 2008, 11:21 AM
> hi,
> I have a column with full of data like ATB-OO NCK-TT
> .... how can I
> easily remove the "-" ? it seems that the
> "-" is allways the fourth letter.
>
> thanks,
> Pere
> --
> View this message in context:
> http://www.nabble.com/removing-a-portion-of-text-tp20067248p20067248.html
> Sent from the PostgreSQL - general mailing list archive at
> Nabble.com.
>
>
with fixed length

select substring(tex1,1,3) || substring(tex1,5) from t1

with variable length

select substring(tex1,1,strpos(tex1,'-'::varchar)-1) || substring(tex1,strpos(tex1,'-'::varchar)+1) from t1

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrei Kovalevski 2008-10-20 14:14:35 Re: [ODBC] Error in Adding All Table
Previous Message Sergey Konoplev 2008-10-20 14:07:00 Re: index scan leads to result that is different from sec scan after upgrading to 8.3.4