Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 156C89FB3F8 for ; Sun, 15 Oct 2006 11:50:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 25597-04 for ; Sun, 15 Oct 2006 14:50:01 +0000 (UTC) X-Greylist: delayed 00:59:59.919938 by SQLgrey- Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by postgresql.org (Postfix) with ESMTP id 561F59FA5B4 for ; Sun, 15 Oct 2006 11:50:01 -0300 (ADT) Received: from tedy ([70.82.131.58]) by VL-MO-MR004.ip.videotron.ca (Sun Java System Messaging Server 6.2-2.05 (built Apr 28 2005)) with ESMTP id <0J76000O7JRBUJ90@VL-MO-MR004.ip.videotron.ca> for pgsql-sql@postgresql.org; Sun, 15 Oct 2006 09:49:59 -0400 (EDT) Date: Sun, 15 Oct 2006 09:49:55 -0400 From: Daniel CAUNE Subject: Re: migrating numeric to serial from MSSQL to postgres In-reply-to: <56210BFF-763D-4FC2-AA43-D514C19DB37F@thenilgiris.com> To: 'Kenneth Gonsalves' , pgsql-sql@postgresql.org Message-id: <000f01c6f060$cbd505e0$0b00a8c0@tedy> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 X-Mailer: Microsoft Office Outlook 11 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Thread-index: AcbwXNlNSOyF/C62T/i4J03YGAJ6rQAA4JnA X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200610/142 X-Sequence-Number: 26531 > 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