Re: Stripping empty space from all fields in a table?

From: Bricklen Anderson <banderson(at)presinet(dot)com>
To: J B <jbwellsiv(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Stripping empty space from all fields in a table?
Date: 2006-10-27 21:56:43
Message-ID: 4542809B.9090702@presinet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

J B wrote:
> Guys,
>
> I have a table that has various fields that have whitespace in the
> values. I'd like to roll through and strip the left and right whitespace
> out of all fields that contain strings.
>
> Is there any easy way to do this?
>
> Thanks!
>
> JB

"trim" will strip the whitespace from both sides. ltrim and rtrim are
front/back specific.

select '-'||trim(' asdf ')||'-';
?column?
----------
-asdf-

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GUNDUZ 2006-10-27 22:03:23 Re: plpython.so
Previous Message Marc G. Fournier 2006-10-27 21:56:11 Re: Mailing list problem?