Re: How to perform an identical insert?

Поиск
Список
Период
Сортировка
От Darren Ferguson
Тема Re: How to perform an identical insert?
Дата
Msg-id Pine.LNX.4.10.10203220856280.29630-100000@thread.crystalballinc.com
обсуждение исходный текст
Ответ на How to perform an identical insert?  ("Axel Selk" <sel@biba.uni-bremen.de>)
Список pgsql-general
You can make the field an integer field and then have a sequence that will
be your autonumber counter such as

CREATE SEQUENCE test_seq START
<the_last_number_plus_1_in_your_MS-Access_sequence>;

CREATE TABLE foo (
  foo_id INTEGER DEFAULT NEXTVAL('test_seq') NOT NULL
);

This will then mean you do not have to insert anything into that field
since it will take the next value in the sequence.
But if you do insert a value then you can still specify your own integer
if you want. Note though that when you specify your own integer you will
have to be careful since the sequence will not know about that integer.

HTH

Darren Ferguson

On Fri, 22 Mar 2002, Axel Selk wrote:

> Dear list,
> I have collected data in a Microsoft Access data base and I am trying
> now to transfer this data to a postgres data base running on a Linux
> computer. I generated SQL scripts for the structure as well as for the
> data. I have trouble with the data inserts. I want to insert the MS
> Access IDs into Postgres as all references are made to those IDs.
> But I found only the ID serial format in Postgres, which does not accept
> inserted IDs. Is there any way to insert the IDs from Access and then
> using the serial ID for any further action in Postgres?
>
> Please, advice.
>
>
> With kind regards
>
> Axel Selk
> --
>
> Dipl.-Ing. Axel Selk
>
> Bremen Institute of Industrial Technology and
> Applied Work Science (BIBA)
> - Division BIBA PPC -
> Hochschulring 20
> 28359 Bremen
> Germany
>
> phone:  +49 (0)421-218-5637
> fax: +49 (0)421-218-5551
> www.biba.uni-bremen.de
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


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

Предыдущее
От: "Nigel J. Andrews"
Дата:
Сообщение: Re: Huge Performance Difference on Similar Query in Pg7.2
Следующее
От: Heiko Klein
Дата:
Сообщение: Re: How to perform an identical insert?