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 0CB393A4557 for ; Thu, 11 Nov 2004 17:22:29 +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 49212-02 for ; Thu, 11 Nov 2004 17:22:20 +0000 (GMT) Received: from smtp.enter.net (smtp.enter.net [216.193.128.24]) by svr1.postgresql.org (Postfix) with ESMTP id 5D2613A4B0F for ; Thu, 11 Nov 2004 15:38:01 +0000 (GMT) Received: from localhost (mmail.enter.net [216.193.128.40]) by smtp.enter.net (Postfix) with ESMTP id 29D72CD6D5 for ; Thu, 11 Nov 2004 10:38:02 -0500 (EST) Received: from [216.193.128.221] (fahey.enter.net [216.193.128.221]) by smtp.enter.net (Postfix) with ESMTP id 13EF1CCAAB for ; Thu, 11 Nov 2004 10:38:02 -0500 (EST) Message-ID: <419386D5.9060502@enter.net> Date: Thu, 11 Nov 2004 10:35:49 -0500 From: Mike Fahey User-Agent: Mozilla Thunderbird 0.8 (X11/20041104) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Postgres list Subject: Problem with curval Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checker-Version: Enter.Net Virus Scanner 1.1 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/37 X-Sequence-Number: 4651 This wont work because myvalue must be a record or row variable. I'm guessing its nearly impossible to get the last inserted id from access 2003 using postgres odbc. select @@IDENTITY always returns "2". Thoughts? create function last_insert_id(varchar,varchar ) returns integer as ' declare intable alias for $1; incolumn alias for $2; myvalue integer; BEGIN for myvalue in execute '' select currval('''' '' || intable || ''_'' || incolumn || ''_seq'''') '' Loop return myvalue; END loop; END; ' language plpgsql; -- 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 ********************************************************************