Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id CDCE59FBDD6 for ; Fri, 16 Mar 2007 22:40:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 23486-07 for ; Fri, 16 Mar 2007 22:40:07 -0300 (ADT) X-Greylist: delayed 00:20:12.852071 by SQLgrey-1.7.4 Received: from aibo.runbox.com (aibo.runbox.com [193.71.199.94]) by postgresql.org (Postfix) with ESMTP id 7B6BC9FB61B for ; Fri, 16 Mar 2007 22:40:12 -0300 (ADT) Received: from [10.9.9.130] (helo=fenris.runbox.com) by greyhound.runbox.com with esmtp (Exim 4.50) id 1HSNaL-0000rI-Ai; Sat, 17 Mar 2007 02:19:53 +0100 Received: from mail by fenris.runbox.com with local (Exim 4.50) id 1HSNaL-0003K5-8U; Sat, 17 Mar 2007 02:19:53 +0100 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Received: from [24.210.132.226] by www.runbox.com with http (uid:277232) (RMM 4.0); Sat, 17 Mar 2007 01:19:53 GMT From: "Josh Williams" To: shavonne.marietta@studioform.it CC: pgsql-sql@postgresql.org Subject: Re: INSERT INTO Date: Fri, 16 Mar 2007 20:19:53 -0500 (EST) X-Sender: 277232 X-Mailer: RMM References: <002c01c767a8$20d5d600$1102a8c0@dream> In-Reply-To: <002c01c767a8$20d5d600$1102a8c0@dream> Message-Id: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=BAYES_50, SPF_PASS X-Spam-Level: X-Archive-Number: 200703/235 X-Sequence-Number: 27873 From: "Shavonne Marietta Wijesinghe" > I have 2 tables. TABLE1 and TABLE2. > > TABLE1 has about 400 records with details (client code, name, surname, > address, date of birth) of my clients. > TABLE2 is filled with some of the client details and other extra details > (client code, address, telephone, etc) > > So in my ASP page i have a select that gets the client details from TABLE1 > using the client code and inserts them in to TABLE2 > > When i have a string that has a ' inside of it the record is not inserted= in > to TABLE2. I know that writing it twice will fix it but how can i ask my = ASP > code to do it.. I'm sadly tasked with maintaining a little ASP code from time to time. If = you need to do it through a script, what you're looking for is the Replace = function, as already mentioned in the thread: Replace( InputString, "'", "''" ) However since we're already on pgsql-sql, assuming you're not doing a whole= lot more than pulling from one table and inserting into another, you may w= ant to consider seeing if you can roll it into a single SQL statement: > INSERT INTO TABLE2 (TE_INDI) VALUES ('SANT'ANGELO LODIGIANO'); INSERT INTO TABLE2 (TE_INDI) VALUES SELECT TE_INDI FROM TABLE1 WHERE (...) No quoting or server->client->server worries to deal with at all... Best of luck, - Josh Williams