Re: migrating numeric to serial from MSSQL to postgres

Поиск
Список
Период
Сортировка
От Daniel CAUNE
Тема Re: migrating numeric to serial from MSSQL to postgres
Дата
Msg-id 000f01c6f060$cbd505e0$0b00a8c0@tedy
обсуждение исходный текст
Ответ на migrating numeric to serial from MSSQL to postgres  (Kenneth Gonsalves <lawgon@thenilgiris.com>)
Список pgsql-sql
> hi,
> 
> am migrating a database from MSSQL to postgres. How would i migrate
> this:
> 
> [Id] [numerc](18, 0) IDENTITY (1, 1)
> 

You might want to create a sequence first, such as with more or less
options:

CREATE SEQUENCE my_sequence INCREMENT BY 1 MINVALUE 1 NO MAXVALUE START WITH 1 CACHE 1 NO CYCLE;

Then you should be able to migrate your code to something like:
 Id INTEGER NOT NULL DEFAULT NEXTVAL(my_sequence')

--
Daniel



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

Предыдущее
От: Terry Fielder
Дата:
Сообщение: Re: migrating numeric to serial from MSSQL to postgres
Следующее
От: Daniel CAUNE
Дата:
Сообщение: Re: migrating numeric to serial from MSSQL to postgres