X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8B7EB3A47CB for ; Fri, 12 Nov 2004 18:00:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 69168-07 for ; Fri, 12 Nov 2004 18:00:17 +0000 (GMT) Received: from iserver.abag.ca.gov (iserver.abag.ca.gov [198.31.87.3]) by svr1.postgresql.org (Postfix) with ESMTP id 21C703A47BD for ; Fri, 12 Nov 2004 18:00:16 +0000 (GMT) Received: from groupwise.abag.ca.gov (groupwise.abag.ca.gov [198.31.87.26]) by iserver.abag.ca.gov (8.13.1/8.13.1) with ESMTP id iACI0Djp000665 for ; Fri, 12 Nov 2004 10:00:13 -0800 (PST) Received: from D01-MTA by groupwise.abag.ca.gov with Novell_GroupWise; Fri, 12 Nov 2004 10:00:12 -0800 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.5.1 Date: Fri, 12 Nov 2004 09:59:53 -0800 From: "Fred Parkinson" To: , Subject: Re: Getting the last inserted id Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/49 X-Sequence-Number: 4663 Mike Personally, if you are trying to do what I think you are trying to do, I accomplish it with a 'trick' (aka kludge). When users open my Access 2000 app I add a record to an Access table called 'sessions' and keep track of the session_id which is created. The postgres records I need id's from have the session id stored in them at creation with the rest of the data, as well as a timestamp. so I do the following to get the key value of the record I just created: MyNow = Now() rsData.AddNew .... rsData!creation_date = MyNow rsData!session_id = MySession .... rsData.Update then I run a query which asks for the key value of the record with session_id = MySession and creation_date = MyNow. Works every time Lots of luck Fred >>> Mike Fahey 11/12/2004 9:36:23 AM >>> So I guess the question still remains, how do you get the last inserted id from a sequence? I'm using access 2003 & postgres odbc 8.0.02 select @@IDENTITY seems to be MS Specific and not work with postgres. calling currval has to be a pass-through query which makes it high complicated if at all possible. How does everyone else do this ? How does any database maintain referential integrity if this doesn't work? ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)