Sequence - Use calculated start value?

From: Aragorn <aragorn(at)gondor(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Sequence - Use calculated start value?
Date: 2002-10-30 18:15:28
Message-ID: 4lVv9.634445$Ag2.24397308@news2.calgary.shaw.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Aragorn wrote:

> I need to use a calculated start value for some sequences. eg:
>
> CREATE SEQUENCE tblco_cntcoid_key start (SELECT (MAX(cntcoid) + 100)
> FROM tblco) increment 1 maxvalue 2147483647 minvalue 1 cache 1;
>
> when I try this I get:
> ERROR: parser: parse error at or near (
>
> I am migrating an MS Access DB to postgresql and need to retain the
> current value of the id columns (er cntcoid), but when I insert new
> values I want the cntcoid to start at a number greater than the last
> one in the table. When I use a normal sequence or serial type for the
> id, any new records are inserted starting at id 1.
>
> Anyone know how to do this?
>
> Thanks
>

--
Ron St.Pierre
Syscor R&D
tel: 250-361-1681
email: rstpierre(at)syscor(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-10-30 18:19:02 Re: permission prob: granted, but still denied
Previous Message Aragorn 2002-10-30 18:02:00 Sequence - Use calculated start value?