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 B14D93A4573 for ; Thu, 11 Nov 2004 21:19: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 46332-05 for ; Thu, 11 Nov 2004 21:19:20 +0000 (GMT) Received: from web20827.mail.yahoo.com (web20827.mail.yahoo.com [216.136.227.166]) by svr1.postgresql.org (Postfix) with SMTP id CD97E3A454B for ; Thu, 11 Nov 2004 21:19:20 +0000 (GMT) Received: (qmail 17327 invoked by uid 60001); 11 Nov 2004 21:19:20 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=KhBLauCOFzfrI+p6xRbFlYJUVUaihz+CE5UusnVWZrsgWLcJ2jx5nMbg0g4CdLYZnEfAosZTb8q1f4NCn+qzJuhLqkmVCU4afi6HFLgnJWWwye0VfNn4Y42MfThQr2btngteX7CTOkrr50XaMgVB6XmrNXfk88sz4fRYAZ1NtcQ= ; Message-ID: <20041111211920.17325.qmail@web20827.mail.yahoo.com> Received: from [24.248.12.141] by web20827.mail.yahoo.com via HTTP; Thu, 11 Nov 2004 13:19:20 PST Date: Thu, 11 Nov 2004 13:19:20 -0800 (PST) From: Jeff Eckermann Subject: Re: Problem with curval To: Mike Fahey , Postgres list In-Reply-To: <419386D5.9060502@enter.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/42 X-Sequence-Number: 4656 --- Mike Fahey wrote: > 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; myvalue record; > > BEGIN > > for myvalue in execute '' select currval('''' '' > || intable || ''_'' || incolumn > || ''_seq'''') > '' Loop as myalias'' Loop > return myvalue; return myvalue.myalias; (you may need to do some casting, but I suspect that plpgsql will take care of that for you) > > > 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 > ******************************************************************** > > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to > majordomo@postgresql.org > __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com