Article View: borland.public.interbase.sql
Article #11106Re: Last insert key
From: Craig Stuntz TeamB
Date: Thu, 12 Dec 2002 17:55
Date: Thu, 12 Dec 2002 17:55
35 lines
2097 bytes
2097 bytes
In article <3df8ca1e$1@newsgroups.borland.com>, rim@novicom.nl says... > But how do i get the ID???? SELECT GEN_ID(FOO_G, 1) FROM RDB$DATABASE > and then the trigger is only fired when i have an insert... Change the trigger so that it only gets a new ID if the ID column is NULL. > or do i have 2 use the generated key to insert that as a value in my insert > query???? I don't understand the question. > what would the use be of the GEN_ID() You need GEN_ID to get a generator value, no matter when you do it. > and oninsert function??? > Do you mean a BEFORE INSERT trigger? If so, you can use this to fill in the ID when it is done outside the context of your program (e.g., SQL Explorer). -Craig -- Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH Delphi/InterBase Weblog : http://delphi.weblogs.com InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer
Technical Details
Message-ID:
<MPG.186297b31bc0551d98a3c6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3df8bc1a$1@newsgroups.borland.com> <MPG.18628e9dc84bf9dc98a3c1@newsgroups.borland.com> <3df8ca1e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 114a0e,1f84ba5a3b79c5df X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-12 10:08:19 PST From: Craig Stuntz [TeamB] <cstuntz@nospamplease.com (but use vertexsoftware to email)> Newsgroups: borland.public.interbase.sql Subject: Re: Last insert key Date: Thu, 12 Dec 2002 12:55:52 -0500 Message-ID: <MPG.186297b31bc0551d98a3c6@newsgroups.borland.com> References: <3df8bc1a$1@newsgroups.borland.com> <MPG.18628e9dc84bf9dc98a3c1@newsgroups.borland.com> <3df8ca1e$1@newsgroups.borland.com> Organization: Vertex Systems Corporation X-Newsreader: MicroPlanet Gravity v2.60 NNTP-Posting-Host: 65.86.87.242 X-Trace: newsgroups.borland.com 1039715760 65.86.87.242 (12 Dec 2002 09:56:00 -0800) Lines: 35 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!newsfeed.news2me.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail