Skip site navigation (1) Skip section navigation (2)

Re: migrating numeric to serial from MSSQL to postgres

From: Daniel CAUNE <d(dot)caune(at)free(dot)fr>
To: 'Kenneth Gonsalves' <lawgon(at)thenilgiris(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: migrating numeric to serial from MSSQL to postgres
Date: 2006-10-15 13:49:55
Message-ID: 000f01c6f060$cbd505e0$0b00a8c0@tedy (view raw or flat)
Thread:
Lists: 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


In response to

pgsql-sql by date

Next:From: Terry FielderDate: 2006-10-15 13:54:45
Subject: Re: migrating numeric to serial from MSSQL to postgres
Previous:From: Kenneth GonsalvesDate: 2006-10-15 13:05:47
Subject: migrating numeric to serial from MSSQL to postgres

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group