Re: @@IDENTITY (Was: Access - ODBC - serial problem)

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
Cc: Philippe Lang <philippe(dot)lang(at)attiksystem(dot)ch>, <jorgens(at)coho(dot)net>, <pgsql-odbc(at)postgresql(dot)org>
Subject: Re: @@IDENTITY (Was: Access - ODBC - serial problem)
Date: 2004-04-09 20:25:46
Message-ID: Pine.LNX.4.33.0404091413030.13358-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

On Fri, 9 Apr 2004, Dave Page wrote:

>
>
> > -----Original Message-----
> > From: Philippe Lang [mailto:philippe(dot)lang(at)attiksystem(dot)ch]
> > Sent: 09 April 2004 13:33
> > To: jorgens(at)coho(dot)net; pgsql-odbc(at)postgresql(dot)org
> > Subject: Re: [ODBC] Access - ODBC - serial problem...
> >
> > Is there a Postgresql ODBC driver guru that could give us an
> > idea for a driver modification? I don't know the exact job of
> > an ODBC driver, nor how it connects to Postgresql, so I
> > cannot tell if it would be possible to modify the ODBC
> > driver, and do something like a "SELECT @@IDENTITY" (which is
> > a SQL Server 2000 call, correct).
> >
> > Since Microsoft is behind both Access and SQL Server, maybe
> > nothing can be done in the driver itself, and I'll have to
> > handle my insertions by hand, through pl/pgsql. But really,
> > that's a serious limitation...
>
> SELECT CURRENT_USER;
>
> Though I suspect that is not what you want. Are you asking for the
> driver to translate '@@IDENTITY' into 'CURRENT_USER'?

For reasons unfathomable to modern man, Microsoft chose @@IDENTITY to
mean, not the current user, as I or you or any sane person would expect,
but to hold the incremented value of an autoincrementing column fed by an
insert. Another triumph in orthogonally named things from Microsoft.

Anyway, what the original conversation was about was getting back the auto
increment value from pgsql via ODBC with access on top. The problem being
that postgresql doesn't have a simple "what was the autoincrement I just
put in" but requires the user to either use the system catalogs to look up
the sequence name and then use currval on it, or something like a plpgsql
function to insert your data.

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Bruce Momjian 2004-04-09 20:36:08 Re: ODBC driver further developments?
Previous Message Bruce Momjian 2004-04-09 19:24:27 Re: ODBC driver further developments?