Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 07AC29FB652 for ; Tue, 3 Apr 2007 07:01:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 01826-04 for ; Tue, 3 Apr 2007 07:00:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from smtpout25.fbc.local (smtpout25.attiva.biz [85.37.16.26]) by postgresql.org (Postfix) with ESMTP id 144C29FB644 for ; Tue, 3 Apr 2007 07:00:54 -0300 (ADT) Received: from FBCMFE02B15.fbc.local ([192.168.30.161]) by smtpout25.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Tue, 3 Apr 2007 12:00:52 +0200 Received: from dream ([88.34.161.130]) by FBCMFE02B15.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Tue, 3 Apr 2007 11:54:49 +0200 Message-ID: <00b101c775d6$2d313840$1102a8c0@dream> Reply-To: "Shavonne Marietta Wijesinghe" From: "Shavonne Marietta Wijesinghe" To: References: <008301c775d1$4b224420$1102a8c0@dream> <20070403093222.GB30108@a-kretschmer.de> Subject: Re: Serial Date: Tue, 3 Apr 2007 11:55:10 +0200 Organization: Studio FORM MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3028 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-OriginalArrivalTime: 03 Apr 2007 09:54:50.0332 (UTC) FILETIME=[1EC979C0:01C775D6] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/20 X-Sequence-Number: 28020 thanks. I read the page you gave. CREATE SEQUENCE seq_mytable_n_gen; CREATE TABLE mytable ( n_gen int nextval('seq_mytable_n_gen'), mycolumn1 int, mycolumn2 int ); i tried creating it like that. The sequence was created without any error. But for the create table i get ERROR: syntax error at or near "nextval" at character 38 What should i do? Shavonne Wijesinghe ----- Original Message ----- From: "A. Kretschmer" To: Sent: Tuesday, April 03, 2007 11:32 AM Subject: Re: [SQL] Serial > am Tue, dem 03.04.2007, um 11:20:16 +0200 mailte Shavonne Marietta > Wijesinghe folgendes: >> The problem is when i INSERT a new record. It takes the value n_gen = 6 >> but i >> need it to take the value 5. It keeps a record of the delete records. >> >> Is there anyway in PostgreSQL i can change it? or another progressive >> that i >> can use for n_gen ?? > > Yes, setval(). > http://www.postgresql.org/docs/8.1/interactive/functions-sequence.html > > > Andreas > -- > Andreas Kretschmer > Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) > GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net > > ---------------------------(end of broadcast)--------------------------- > TIP 7: You can help support the PostgreSQL project by donating at > > http://www.postgresql.org/about/donate