Received: from shaked.cc.openu.ac.il (shaked.cc.openu.ac.il [147.233.145.65]) by hub.org (8.8.8/8.7.5) with ESMTP id EAA09310 for ; Sun, 30 Aug 1998 04:57:15 -0400 (EDT) Received: from [147.233.159.109] (herouth@mac-herouth.pc.openu.ac.il [147.233.159.109]) by shaked.cc.openu.ac.il (8.8.5/8.8.5) with ESMTP id LAA20412; Sun, 30 Aug 1998 11:56:45 +0300 (IDT) X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: References: <001601bdd1f4$c3f9df00$a3f0f6ce@bryan.arcamax.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Sun, 30 Aug 1998 11:58:13 +0300 To: Walt Bigelow From: Herouth Maoz Subject: Re: [SQL] copy one to many? Cc: pgsql-sql@postgreSQL.org At 6:06 +0300 on 28/8/98, Walt Bigelow wrote: > I was looking more on the lines of a list of dest values. This list is by > no means in order, or sequential. > > For example: I want to copy this data TO this list of lib #'s > > 3422, 4456, 7743... etc (baiscally random) > > I'd prefer to have 1 insert statment do the job. Right now I have M$ > Access doing this in a for/next loop, changing the dest lib number for > each in the list. > > I'd prefer to do this on the server end. Whould this be easy to do with > server side funcs? Well.... SQL was NOT designed as a procedural language, and when you have data of a 'random' nature, as you said, you need a procedural languague, which the current backend doesn't have. If you want to insert just the new lib numbers into an auxiliary table, you can easily do the insert as a cartesian product between the rows you want to duplicates and the rows in the auxiliary table. Of course, then you'll need a loop for inserting the lib values into the auxiliary table - or you can do that with a COPY. Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma