Skip site navigation (1) Skip section navigation (2)

Re: removing leading and trailing blanks from every row in a table

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: removing leading and trailing blanks from every row in a table
Date: 2009-01-25 00:39:09
Message-ID: glgcbd$4t1$10@reversiblemaps.ath.cx (view raw or flat)
Thread:
Lists: pgsql-novice
On 2009-01-21, Wm.A.Stafford <stafford(at)marine(dot)rutgers(dot)edu> wrote:
> I need a procedure to remove leading and trailing blanks from column of 
> every row in a table.  I would like to pass the table name as a 
> parameter and have the procedure do the rest.  Does something like this 
> already exist?  Is it even possible?

the sql to do this is 

UPDATE tablename SET columnname=TRIM( columnname );

Do you really need a function?


In response to

pgsql-novice by date

Next:From: Jasen BettsDate: 2009-01-25 01:05:52
Subject: Re: SQL Question: Averages of intervals.
Previous:From: Daniel StaalDate: 2009-01-24 18:19:48
Subject: Re: SQL Question: Averages of intervals.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group