Use SELECT FIRST 1 gen_id(my_generator, 1) FROM any_non_empty_table
This will return you one record. Roman Kai Bohli wrote: > Hi Rick ! > > > > Thanks a lot for your reply. > > The generator code runs fine in my old version of “Interbase Workbench”. > > I cannot create a new table in this database. I have to use whatever is > already made in this case since I’m not in control of the database. I > also have to use a generator that’s already there. > > > > Best wishes > > > > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > Norway > > > > > > > > *From:* > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > *On Behalf Of *Rick Roen > *Sent:* 8. mai 2007 12:32 > *To:* 'For users and developers of the Firebird .NET providers' > *Subject:* Re: [Firebird-net-provider] Issue with .net provider to work > with aFirebird generator > > > > Kai, > > > > I have used this type of select in VB.Net 2005 and the query analyzer > does complain about the “$”, however it does actually work and return > the result. I think I get something about a “problem near ‘$’…”. > > > > Have you tried to run the generator code? > > > > If it does not even compile there is another suggestion: The > “RDB$Database” table is only used for convenience. It has only one row > so it will only return one result, i.e. one new generator value. If you > can create a table in your DB that has only one row, you can use that > table instead of “RDB$Database”. For example create a new table > “GenTable” with one Integer row and give it a value of 0. Then you can > rewrite your select like this: “Select gen_id(GEN_WEBOBJECTNR,1) as id > from GenTable” > > > > HTH, > > > > Rick > > > > ------------------------------------------------------------------------ > > *From:* > [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > *On Behalf Of *Kai Bohli > *Sent:* Monday, May 07, 2007 1:17 PM > *To:* For users and developers of the Firebird .NET providers > *Subject:* [Firebird-net-provider] Issue with .net provider to work with > aFirebird generator > > > > Hi all ! > > > > I have an existing table which I cannot change. That is, I cannot create > a on before insert trigger on it. I have to know the generator value > before insert so I have to run something like this: > > > > SELECT gen_id(GEN_WEBOBJECTNR, 1) AS id FROM rdb$database > > > > So far so good. Since I have all the dataaccess in a separate layer > (DLL) using the DDEX provider, I would like to keep this in a > tableadapter. But the queryanalyser chokes on the $ sign in > rdb$database. And if I include the name in “ like this “rdb$database” it > will find the table but only 4 – 5 columns. The generators are not > there. I could use a FBCommand through code to get passed the > queryanalyser, but then I met other problems. > > > > Any help are greatly appreciated. > > > > Thanks in advance. > > > > Best wishes > > > > [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > > Norway > > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Firebird-net-provider mailing list > Firebird-net-provider@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider