| From: | Richard Broersma Jr <rabroersma(at)yahoo(dot)com> | 
|---|---|
| To: | operationsengineer1(at)yahoo(dot)com, pgsql-novice(at)postgresql(dot)org | 
| Subject: | Re: Insert Question | 
| Date: | 2006-11-02 20:21:27 | 
| Message-ID: | 12337.980.qm@web31809.mail.mud.yahoo.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-novice | 
> 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.
create sequence tmp_seq start with 42000000;
update products set document_number = nextval('tmp_seq');
Would this do what you want?
Regards,
Richard Broersma Jr.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Davis, Sean (NIH/NCI) [E] | 2006-11-02 20:21:33 | Re: Number of fields in split() | 
| Previous Message | A. Kretschmer | 2006-11-02 20:18:28 | Re: Insert Question |