pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedObtain Serial Value
3+ messages / 3 participants
[nested] [flat]
* Obtain Serial Value
@ 2006-02-08 14:03 Sistemas C.M.P. <sistemascmp@redynet4.com.ar>
2006-02-08 14:32 ` Re: Obtain Serial Value Timothy Reed <tareed@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Sistemas C.M.P. @ 2006-02-08 14:03 UTC (permalink / raw)
To: pgsql-odbc
I am using VB6+ADO+ODBC with pgSQL.
I need to obtain the value of a serial field (autogenerated) inmediatly after I do a INSERT query. How can I do?
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Obtain Serial Value
2006-02-08 14:03 Obtain Serial Value Sistemas C.M.P. <sistemascmp@redynet4.com.ar>
@ 2006-02-08 14:32 ` Timothy Reed <tareed@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Timothy Reed @ 2006-02-08 14:32 UTC (permalink / raw)
To: Sistemas C.M.P. <sistemascmp@redynet4.com.ar>; +Cc: pgsql-odbc
You should try SELECT MAX( <fieldname> ) FROM <tablename>; ??
On 2/8/06, Sistemas C.M.P. <sistemascmp@redynet4.com.ar> wrote:
>
> I am using VB6+ADO+ODBC with pgSQL.
> I need to obtain the value of a serial field (autogenerated) inmediatly
> after I do a INSERT query. How can I do?
>
--
--------
Timothy Reed
tareed@gmail.com
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Obtain Serial Value
@ 2006-02-08 14:46 Trewern, Ben <Ben.Trewern@mowlem.com>
0 siblings, 0 replies; 3+ messages in thread
From: Trewern, Ben @ 2006-02-08 14:46 UTC (permalink / raw)
To: Timothy Reed <tareed@gmail.com>; Sistemas C.M.P. <sistemascmp@redynet4.com.ar>; +Cc: pgsql-odbc
Try using SELECT currval('sequenc_name');
From the docs:
Return the value most recently obtained by nextval for this sequence in
the current session. (An error is reported if nextval has never been
called for this sequence in this session.) Notice that because this is
returning a session-local value, it gives a predictable answer whether
or not other sessions have executed nextval since the current session
did.
This should be much faster than SELECT max(... and transaction safe.
Regards,
Ben
-----Original Message-----
From: pgsql-odbc-owner@postgresql.org
[mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Timothy Reed
Sent: 08 February 2006 14:32
To: Sistemas C.M.P.
Cc: pgsql-odbc@postgresql.org
Subject: Re: [ODBC] Obtain Serial Value
You should try SELECT MAX( <fieldname> ) FROM <tablename>; ??
On 2/8/06, Sistemas C.M.P. <sistemascmp@redynet4.com.ar > wrote:
I am using VB6+ADO+ODBC with pgSQL.
I need to obtain the value of a serial field
(autogenerated) inmediatly after I do a INSERT query. How can I do?
--
--------
Timothy Reed
tareed@gmail.com
-------------------------------------------------------------------
This email and any attachments transmitted with it are confidential (and potentially legally privileged) and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender and do not store, copy or disclose the content to any other person.
It is the responsibility of the recipient to ensure that opening this message and/or any of its attachments will not adversely affect its systems. No responsibility is accepted by the sender.
-------------------------------------------------------------------
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-02-08 14:46 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-08 14:03 Obtain Serial Value Sistemas C.M.P. <sistemascmp@redynet4.com.ar>
2006-02-08 14:32 ` Timothy Reed <tareed@gmail.com>
2006-02-08 14:46 Re: Obtain Serial Value Trewern, Ben <Ben.Trewern@mowlem.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox