Re: Insert Question - Mailing list pgsql-novice

From Davis, Sean \(NIH/NCI\) [E]
Subject Re: Insert Question
Date
Msg-id 014DBF86B19310419F0DF8910FC56457240CF8@nihcesmlbx10.nih.gov
Whole thread Raw
In response to Insert Question  (<operationsengineer1@yahoo.com>)
List pgsql-novice
I would look at creating a temp table as:

select product_number,generate_series(4200001,4200001+(select count(*) from product_number)) order by product_number;

Then rename the temp table back to the original table.

Sean



-----Original Message-----
From: operationsengineer1@yahoo.com [mailto:operationsengineer1@yahoo.com]
Sent: Thu 11/2/2006 3:01 PM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] Insert Question

hhi all,

long time no askie question, but here goes...

i want to insert sequential document numbers into a
products table

my current setup is like so:

product_number document_number
1001
1002
1006
1005

i want an insert statement that will yield the
following:

product_number document_number
1001           42000001
1002           42000002
1006           42000003
1005           42000004

relative order means nothing, but i do want sequential
document numbers.

how can i go about getting this done as efficiently as
possible?

as always, tia.



__________________________________________________________________________________________
Check out the New Yahoo! Mail - Fire up a more powerful email and get things done faster.
(http://advision.webevents.yahoo.com/mailbeta)


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


pgsql-novice by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Insert Question
Next
From: Richard Broersma Jr
Date:
Subject: Re: Insert Question