From: | Prabu Subroto <prabu_subroto(at)yahoo(dot)com> |
---|---|
To: | Postgres General Milis <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: altering a table to set serial function |
Date: | 2004-07-28 13:20:43 |
Message-ID: | 20040728132044.68234.qmail@web41802.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
This is exactly what I need..
Thank you very much for your kindness, Doug.
Thank you...thank you...very....very,,, much.
--- Doug McNaught <doug(at)mcnaught(dot)org> wrote:
> Prabu Subroto <prabu_subroto(at)yahoo(dot)com> writes:
>
> > If I read your suggestion, that means...I have
> drop
> > the column "salesid" and re-create the column
> > "salesid". and it means, I will the data in the
> > current "salesid" column.
> >
> > Do you have further suggestion?
>
> You can do it "by hand" without dropping the column:
>
> CREATE SEQUENCE salesid_seq;
> SELECT setval('salesid_seq', (SELECT max(salesid)
> FROM sales) + 1);
> ALTER TABLE sales ALTER COLUMN salesid DEFAULT
> nextval('salesid_seq');
>
> This is the same thing that the SERIAL datatype does
> "behind the
> scenes".
>
> I can't vouch for the exact syntax of the above but
> that should get
> you started.
>
> -Doug
> --
> Let us cross over the river, and rest under the
> shade of the trees.
> --T. J. Jackson, 1863
>
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
From | Date | Subject | |
---|---|---|---|
Next Message | Marty Alchin | 2004-07-28 13:34:31 | Cascade Order |
Previous Message | Prabu Subroto | 2004-07-28 13:17:54 | Re: altering a starting value of "serial" macro |