X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F35F1474E4F for ; Sat, 22 Mar 2003 05:03:51 -0500 (EST) Received: from trade-india.com (ns5.trade-india.com [66.234.10.13]) by postgresql.org (Postfix) with SMTP id 7B68A474E44 for ; Sat, 22 Mar 2003 05:03:51 -0500 (EST) Received: (qmail 9187 invoked by uid 505); 22 Mar 2003 10:03:36 -0000 Received: from mallah@trade-india.com by ns5.trade-india.com by uid 502 with qmail-scanner-1.15 (uvscan: v4.1.60/v4171. Clear:. Processed in 1.774812 secs); 22 Mar 2003 10:03:36 -0000 Received: from mail-relay.trade-india.com (HELO system67.trade-india-local.com) (203.196.129.235) by ns5.trade-india.com with SMTP; 22 Mar 2003 10:03:34 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: Sethi Tarun-ETS017 , pgsql-sql@postgresql.org Subject: Re: newline character in SQL Date: Sat, 22 Mar 2003 15:33:44 +0530 User-Agent: KMail/1.5 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200303221533.44147.mallah@trade-india.com> X-Spam-Status: No, hits=-26.1 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT autolearn=ham version=2.50-cvs X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50-cvs (1.172-2003-02-14-exp) X-Archive-Number: 200303/523 X-Sequence-Number: 12562 Use replace function as documented in http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=functions-string.html eg in your case you can do: Select name, replace(name, '\n' , '') as straight_name , comments , replace(comments, '\n' , '') as straight_comment from table where comment like '%Fine%'; please not that replace function is inbuilt in postgresql 7.3.x , i previous versions i am not sure , but there is a work around for older versions. Regds Mallah. On Friday 21 Mar 2003 8:46 am, Sethi Tarun-ETS017 wrote: > How can I remove the newline character from the value of a column. > > For Example: > Select name, comments from table where comment like '%Fine%'; > Results: > NAME COMMENTS > John M. This was a > Fine piece of > work. > > Above, I'd like the Results to appear: > NAME COMMENTS > John M. This was a Fine piece of work. > > I tried substr, instr, hedged right ... but can't get it to work. > > Any help will be greatly appreciated. > > Regards > TS > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.