Re: Insert Question

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: Insert Question
Дата
Msg-id 12337.980.qm@web31809.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Insert Question  (<operationsengineer1@yahoo.com>)
Ответы Re: Insert Question  (<operationsengineer1@yahoo.com>)
Список 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.

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Davis, Sean \(NIH/NCI\) [E]"
Дата:
Сообщение: Re: Insert Question
Следующее
От: "Davis, Sean \(NIH/NCI\) [E]"
Дата:
Сообщение: Re: Number of fields in split()