Thread: @@IDENTITY

@@IDENTITY

From
Mike Fahey
Date:
Does select @@IDENTITY  work with version 8.0.02 ?

IT returns "2" every single time.

All I want to do is get the last inserted id from a sequence.

Suggestions?



--
With best regards,

Mike Fahey - Systems Administration
********************************************************************
      ENTER.NET - "The Road to the Internet Starts Here!" (tm)
  (610) 437-2221 * http://www.enter.net/ * email:support@enter.net
********************************************************************


Re: @@IDENTITY

From
Peter Eisentraut
Date:
Mike Fahey wrote:
> Does select @@IDENTITY  work with version 8.0.02 ?
>
> IT returns "2" every single time.

@ is the absolute value operator.  You probably have a column "identity"
that contains 2 or -2.

> All I want to do is get the last inserted id from a sequence.

Use the currval() function.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/