Re: Selecting Current value from a sequence

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: clayton cottingham <drfrog(at)smartt(dot)com>
Cc: Najm Hashmi <najm(at)mondo-live(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Selecting Current value from a sequence
Date: 2001-01-18 19:29:58
Message-ID: 3A674436.E021A37F@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Clayton,

> > Hi all,
> > It is a very simple but I am not able to recall how to do it.... I
> > just need to find out the current value of a seq. It is very simple
> > select statement but I can't recall it... Help me please before I get
> > myself get fired -:).
> > Regards, Najm
>
> select nextval('nameofseq');

Sorry, no. You want SELECT CURRVAL('sequence_name'). NEXTVAL select
the NEXT value, and increments the sequence in the process.

-Josh Berkus

--
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 436-9166
for law firms, small businesses fax 436-0137
and non-profit organizations. pager 338-4078
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Kaare Rasmussen 2001-01-18 20:46:04 PostgreSQL HOWTO
Previous Message Josh Berkus 2001-01-18 19:11:09 Re: Selecting Current value from a sequence