Return-Path: Mailing-List: contact cocoon-users-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-users@xml.apache.org Received: (qmail 35347 invoked from network); 9 Jan 2001 13:20:08 -0000 Received: from plan9ws1.uct.usm.maine.edu (HELO plan9ws1) (130.111.135.31) by h31.sny.collab.net with SMTP; 9 Jan 2001 13:20:08 -0000 Received: from mcordes by plan9ws1 with local (Exim 3.20 #1 (Debian)) id 14Fyh3-0000KO-00 for ; Tue, 09 Jan 2001 08:20:05 -0500 Date: Tue, 9 Jan 2001 08:20:05 -0500 From: Matthew Cordes To: cocoon-users@xml.apache.org Subject: Re: Help with esql results for 'insert' query Message-ID: <20010109082005.A1253@plan9ws1.uct.usm.maine.edu> References: <004501c07a2f$0f05bde0$4aba3bcb@inflexions> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <004501c07a2f$0f05bde0$4aba3bcb@inflexions>; from perry@inflexions.com on Tue, Jan 09, 2001 at 07:26:48PM +0800 Sender: Matthew Cordes X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N This seems a little dangerous... What if someone inserts another record before you make this call and after you inserted yours, won't you get their owner_id, not yours? The best way to do this is simply disable whatever trigger is auto-creating the ids and select them yourself. In oracle you do select .nextVal from dual then you could insert into some_table (owner_id, ...) values (val_from_above, ...) -matt On Tue, Jan 09, 2001 at 07:26:48PM +0800, Perry Molendijk wrote: > This will also return your latest entry: > > SELECT MAX(owner_id) FROM owners > > I have used in the past in asp applications so I can't see why it wouldn't > work with esql > > ----- Original Message ----- > From: "Paul Brown" > To: > Sent: Tuesday, January 09, 2001 10:30 AM > Subject: RE: Help with esql results for 'insert' query > > > > > > You want to "SELECT @@IDENTITY". Be aware that triggers and transactions > > affect its value. > > > > - Paul > > > > > -----Original Message----- > > > From: eliza.khosrova@TMINUS10.com [mailto:eliza.khosrova@TMINUS10.com] > > > Sent: Monday, January 08, 2001 7:11 PM > > > To: cocoon-users@xml.apache.org > > > Subject: Help with esql results for 'insert' query > > > > > > > > > Hello, > > > > > > I am using MS SQL database and the tables are set up in a way that the > > > primary keys get generated automatically when inserting entries. > > > Is it feasible to get the generated id after 'insert' query in esql? > > > > > > Example: I have a table called 'owners' with three columns: > > > name, address, > > > owner_id where owner_id is the primary key. > > > > > > After I insert as follows: > > > > > > insert into owners values('john smith') > > > > > > would query return the generated id for the entry that I just inserted? > If > > > so, what is the esql tags? I don't seem to find it when looking at the > > > esql logicsheet. Please note that querying based on 'name' or 'address' > > > will not help me because they are not necessarily unique, i.e. I > > > could have > > > entries with same names or address. > > > > > > Any help or suggestion is greatly appreciated. > > > Eliza > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > > > For additional commands, e-mail: cocoon-users-help@xml.apache.org > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > > For additional commands, e-mail: cocoon-users-help@xml.apache.org > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org > For additional commands, e-mail: cocoon-users-help@xml.apache.org >