From: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
---|---|
To: | Walt Bigelow <walt(at)stimpy(dot)com> |
Cc: | pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] copy one to many? |
Date: | 1998-08-30 08:58:13 |
Message-ID: | l03110704b20ec19e0700@[147.233.159.109] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Cho Yan Wong | 1998-08-31 00:36:10 | Re: [SQL] copy probs |
Previous Message | Herouth Maoz | 1998-08-30 08:40:26 | Re: [SQL] Contertine timespan to hours |