Thread View: borland.public.interbase.sql
4 messages
4 total messages
Started by newsgroups.borland.com
Thu, 12 Dec 2002 16:41
Last insert key
Author: newsgroups.borland.com
Date: Thu, 12 Dec 2002 16:41
Date: Thu, 12 Dec 2002 16:41
8 lines
1177 bytes
1177 bytes
Hi there, does anybody know what the smartest way is to get your autonumbered field i'm using D6 with interbase 6 and have a generated id using the trigger in interbase itself thanx in advance Rim
Re: Last insert key
Author: Craig Stuntz TeamB
Date: Thu, 12 Dec 2002 17:17
Date: Thu, 12 Dec 2002 17:17
16 lines
1523 bytes
1523 bytes
In article <3df8bc1a$1@newsgroups.borland.com>, rim@novicom.nl says... > does anybody know what the smartest way is to get your autonumbered field > > i'm using D6 with interbase 6 and have a generated id using the trigger in > interbase itself > Get the ID first, then insert the record. Now you know the ID value. -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
Re: Last insert key
Author: newsgroups.borland.com
Date: Thu, 12 Dec 2002 17:40
Date: Thu, 12 Dec 2002 17:40
30 lines
2114 bytes
2114 bytes
But how do i get the ID???? and then the trigger is only fired when i have an insert... or do i have 2 use the generated key to insert that as a value in my insert query???? what would the use be of the GEN_ID() and oninsert function??? tnx Rim "Craig Stuntz [TeamB]" <cstuntz@nospamplease.com (but use vertexsoftware to email)> schreef in bericht news:MPG.18628e9dc84bf9dc98a3c1@newsgroups.borland.com... > In article <3df8bc1a$1@newsgroups.borland.com>, rim@novicom.nl says... > > does anybody know what the smartest way is to get your autonumbered field > > > > i'm using D6 with interbase 6 and have a generated id using the trigger in > > interbase itself > > > Get the ID first, then insert the record. Now you know the ID > value. > > -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
Re: Last insert key
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads